Clan Grade Script Problem..

This is guide mostly for website tools and code, for example CMS or registration scripts.
There can also be tools.

Moderators: osRose dev team, ospRose dev team, osiRose dev team, Moderators

Clan Grade Script Problem..

Postby Ultra on Thu Apr 05, 2012 8:58 pm

Hi! Today I was try to make a “Change clan grade” script but I don’t know what is wrong ..
First time I was try without “Clan Name:”
And it was change the grade for all clans example : Current clan grade 7 > New Clan grade 4 and then he makes all 7 grade clans to 4. And then I was try this:

----------------------------------------------------------------------------------------------------------------------------------------

*/

if(!session_is_registered(Admin)) {
die('Access Denied');
}
?>
<form id="form1" name="form1" method="post" action="?op=clan_grade">
<table width="275" border="0" align="center">
<tr>
<td width="98">Current Clan Grade: </td>
<td width="167"><label>
<input type="text" name="textfield1">
</label></td>
</tr>
<td width="98">Clan Name: </td>
<td width="167"><label>
<input type="text" name="textfield3">
</label></td>
</tr>
<tr>
<td width="98">New Clan Grade: </td>
<td width="167"><label>
<input type="text" name="textfield2">
</label></td>
</tr>
<tr>
<td>Are you sure? </td>
<td><label>
<input name="sure" type="checkbox" id="sure" value="checkbox">
</label></td>
</tr>
</table>

<p align="center">
<input name="submit" type="submit" id="submit" />
<br />
<br />
<?php
if(isset($_POST['sure'])) {
mysql_query("UPDATE list_clan SET grade = '".$_POST['textfield1']."' WHERE grade = '".$_POST['textfield2']."' SET name = '".$_POST['textfield3']."'");
echo 'Grade changed successfully.';
} else {
echo 'If you want to change the grade, then click the box!';
}
?></p>

</form>

But wont wanna to work o.O!
Soo do someone can fix it / help me ??
Ultra
Rackie
Rackie
 
Posts: 225
Joined: Thu Jul 22, 2010 6:31 pm
Location: Usa

Re: Clan Grade Script Problem..

Postby xadet3 on Fri Apr 06, 2012 11:04 am

Your query is setting every clans grade which matches the 'New Clan Grade' value to the 'Current Grade Value' (with the last part of the query being invalid).

You don't need the current grade because you already have the clan name to search from. You're wanting to do.
  1. // ALWAYS mysql_real_escape_string any user inputted values which are used in queries
  2. $clanGrade = mysql_real_escape_string($_POST['textfield2']);
  3. $clanName = mysql_real_escape_string($_POST['textfield3']);
  4.  
  5. mysql_query("UPDATE list_clan SET grade = '".$clanGrade."' WHERE name = '".$clanName."'");
xadet3
Pero pero
Pero pero
 
Posts: 727
Joined: Tue Jan 08, 2008 11:51 pm
Location: Norwich, England.

Re: Clan Grade Script Problem..

Postby Ultra on Fri Apr 06, 2012 11:21 am

Thanks! :) !
Now it works!
- do it is possible to make : Change Clan logo with uploading picture or something?
- And one more question > do it is possible on clan rankings to show and the logo?
Ultra
Rackie
Rackie
 
Posts: 225
Joined: Thu Jul 22, 2010 6:31 pm
Location: Usa


Return to PHP / Web Guides, Scripts and tools.

Who is online

Users browsing this forum: No registered users and 3 guests

cron