CHAMAVELI Posted July 7, 2008 Share Posted July 7, 2008 Hey guys I receive this error when i open this PHP page: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/gangland/public_html/upgrade.php on line 15 The PHP code is: <?php include "globals.php"; if($ir['exp']==$ir['level']*975) { $ir['level']+=1; $ir['exp']=$expu; $ir['brave']+=2; $ir['maxbrave']+=2; $ir['hp']=(975*$ir['level']); $ir['maxhp']=(975*$ir['level']); mysql_query("UPDATE users SET level=level+1,brave=brave+2,maxbrave=maxbrave+2, hp='{975*$ir['level']}',maxhp='{975*$ir['level']}' WHERE userid=$userid") or die(mysql_error()); mysql_query("UPDATE users SET upgrade=upgrade-1 WHERE userid=$userid") or die(mysql_error()); print"Congratulations! You upgraded to level [b]{$ir['level']}[/b]!"; } else { die("You do not have enough XP to upgrade your level at this time."); } $h->endpage; ?> The error code line is (line 14-16): mysql_query("UPDATE users SET level=level+1,brave=brave+2,maxbrave=maxbrave+2, hp='{975*$ir['level']}',maxhp='{975*$ir['level']}' WHERE userid=$userid") or die(mysql_error()); mysql_query("UPDATE users SET upgrade=upgrade-1 WHERE userid=$userid") or die(mysql_error()); Quote Link to comment Share on other sites More sharing options...
AlabamaHit Posted July 7, 2008 Share Posted July 7, 2008 Re: I need help with PHP Take the ' out of the querys...... mysql_query("UPDATE users SET level=level+1,brave=brave+2,maxbrave=maxbrave+2, hp={975*$ir['level']} ,maxhp={975*$ir['level']} WHERE userid=$userid") or die(mysql_error()); mysql_query("UPDATE users SET upgrade=upgrade-1 WHERE userid=$userid") or die(mysql_error()); Personallly I would change it to something like... $hp = 975 * $ir['level']; $maxhp = 975 * $ir['level']; mysql_query("UPDATE users SET level=level+1, brave=brave+2, maxbrave=maxbrave+2, hp=$hp, maxhp=$maxhp WHERE userid=$userid") or die(mysql_error()); The other query is fine. Quote Link to comment Share on other sites More sharing options...
CHAMAVELI Posted July 8, 2008 Author Share Posted July 8, 2008 Re: I need help with PHP Thanks for that it worked, I changed to the query that you recommended. Quote Link to comment Share on other sites More sharing options...
AlabamaHit Posted July 8, 2008 Share Posted July 8, 2008 Re: I need help with PHP No problem glad to help. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.