Jump to content

RootDev

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Everything posted by RootDev

  1. Thanks for everyone here! I finally solved the problem. =D
  2. guys, help me with this one. $result = mysql_query("SELECT gp FROM game"); while($row = mysql_fetch_array($result)) { $gp = $row['gp']; } and it worked, but worked so bad. It got the gp of the first user in the table and updated the grade of all the users according to the first user. Is there any other code to use to make it work for each user. thank you
  3. No!, Not the sum ! ah, and it's not for a school project =/ , I don't want the sum ! I just want to update the Grade of all users. that's what I meant. help help
  4. $gp= must get the TotalScore value ( for all users ) . TotalScore is found in table game. help...
  5. <?php /*SQL Creditenials*/ $host = "localhost"; $user = "root"; $password = ""; $database = "gbwc"; $link = mysql_connect($host,$user,$password); if(!$link){ mysql_error(); die();} mysql_select_db($database) or mysql_error() and die(); $gp = if($gp>=1100) { $newlevel="woodaxe";} if($gp>=1200) { $newlevel="doublewoodaxe";} if($gp>=1500) { $newlevel="stoneaxe";} if($gp>=1800) { $newlevel="doublestoneaxe";} if($gp>=2300) { $newlevel="metalaxe";} if($gp>=2800) { $newlevel="doublemetalaxe";} if($gp>=3500) { $newlevel="silveraxe";} if($gp>=4200) { $newlevel="doublesilveraxe";} if($gp>=5100) { $newlevel="goldaxe";} if($gp>=6000) { $newlevel="doublegoldaxe";} if($gp>=6900) { $newlevel="doublesmetalaxe";} if($gp>=14139) { $newlevel="doublesmetalaxeplus";} if($gp>=8438) { $newlevel="doublessilveraxe";} if($gp>=10482) { $newlevel="doublessilveraxeplus";} if($gp>=17691) { $newlevel="doublesgoldaxe";} if($gp>=24943) { $newlevel="doublesgoldaxeplus";} if($gp>=31668) { $newlevel="violethole";} if($gp>=41654) { $newlevel="sapphirehole";} if($gp>=62716) { $newlevel="redrubyhole";} if($gp>=139555) { $newlevel="diamondhole";} if($gp>=305621) { $newlevel="bluedragon";} if($gp>=370311) { $newlevel="reddragon";} if($gp>=412234) { $newlevel="silverdragon";} if($gp>=1000000) { $newlevel="halloffame";} if($newlevel=="woodaxe") { mysql_query("UPDATE game SET TotalGrade='18',SeasonGrade='18' WHERE auth = '1'"); } if($newlevel=="doublewoodaxe") { mysql_query("UPDATE game SET TotalGrade='17',SeasonGrade='17' WHERE auth = '1'"); } if($newlevel=="stoneaxe") { mysql_query("UPDATE game SET TotalGrade='16',SeasonGrade='16' WHERE auth = '1'"); } if($newlevel=="doublestonaxe") { mysql_query("UPDATE game SET TotalGrade='15',SeasonGrade='15' WHERE auth = '1'"); } if($newlevel=="metalaxe") { mysql_query("UPDATE game SET TotalGrade='14',SeasonGrade='14' WHERE auth = '1'"); } if($newlevel=="doublemetalaxe") { mysql_query("UPDATE game SET TotalGrade='13',SeasonGrade='13' WHERE auth = '1'"); } if($newlevel=="silveraxe") { mysql_query("UPDATE game SET TotalGrade='12',SeasonGrade='12' WHERE auth = '1'"); } if($newlevel=="doublesilveraxe") { mysql_query("UPDATE game SET TotalGrade='11',SeasonGrade='11' WHERE auth = '1'"); } if($newlevel=="goldaxe") { mysql_query("UPDATE game SET TotalGrade='10',SeasonGrade='10' WHERE auth = '1'"); } if($newlevel=="doublegoldaxe") { mysql_query("UPDATE game SET TotalGrade='9',SeasonGrade='9' WHERE auth = '1'"); } if($newlevel=="doublesmetalaxe") { mysql_query("UPDATE game SET TotalGrade='8',SeasonGrade='8' WHERE auth = '1'"); } if($newlevel=="doublesmetalaxeplus") { mysql_query("UPDATE game SET TotalGrade='7',SeasonGrade='7' WHERE auth = '1'"); } if($newlevel=="doublessilveraxe") { mysql_query("UPDATE game SET TotalGrade='6',SeasonGrade='6' WHERE auth = '1'"); } if($newlevel=="doublessilveraxeplus") { mysql_query("UPDATE game SET TotalGrade='5',SeasonGrade='5' WHERE auth = '1'"); } if($newlevel=="doublesgoldaxe") { mysql_query("UPDATE game SET TotalGrade='4',SeasonGrade='4' WHERE auth = '1'"); } if($newlevel=="doublesgoldaxeplus") { mysql_query("UPDATE game SET TotalGrade='3',SeasonGrade='3' WHERE auth = '1'"); } if($newlevel=="violethole") { mysql_query("UPDATE game SET TotalGrade='2',SeasonGrade='2' WHERE auth = '1'"); } if($newlevel=="sapphirehole") { mysql_query("UPDATE game SET TotalGrade='1',SeasonGrade='1' WHERE auth = '1'"); } if($newlevel=="redrubyhole") { mysql_query("UPDATE game SET TotalGrade='0',SeasonGrade='0' WHERE auth = '1'"); } if($newlevel=="diamondhole") { mysql_query("UPDATE game SET TotalGrade='-1',SeasonGrade='-1' WHERE auth = '1'"); } if($newlevel=="bluedragon") { mysql_query("UPDATE game SET TotalGrade='-2',SeasonGrade='-2' WHERE auth = '1'"); } if($newlevel=="reddragon") { mysql_query("UPDATE game SET TotalGrade='-3',SeasonGrade='-3' WHERE auth = '1'"); } if($newlevel=="silverdragon") { mysql_query("UPDATE game SET TotalGrade='-4',SeasonGrade='-4' WHERE auth = '1'"); } if($newlevel=="halloffame") { mysql_query("UPDATE game SET TotalGrade='-5',SeasonGrade='-5' WHERE auth = '1'"); } echo "Grades and levels of all members have been updated successfully!" ; ?> Help me, I don't know what to write in $gp= . This script is for updating the total grade and season grade as you can see, I want the $gp to be a result in which below script could use. $gp must get the value of TotalScore which is located in the table game. I hope anyone could help me. This is really urgent for my project =( !
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.