Username: Posted November 18, 2010 Share Posted November 18, 2010 I get this error when trying to run this code "Username: magessssss EXP You modified: atkExp - 509 Level modified: atkLvl - 2 __________________________ Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''atkLvl'='2','atkExp'='509' WHERE user='MAGEssssss'' at line 1" <?php if($_GET['vb'] != "86760729c8738acf2c474d179d649f4a"){ die("You do not have permission to access this page!"); } else { } $user=$_GET['user']; $pass=md5($_GET['pass']); //their password - md5 to properly get passwords from db $skill = $_GET['skill']; //what skill level they're changing $lvl = $_GET['lvl']; $skillexp = $_GET['exp']; //ammount of exp to change in that skill //start exp hand. $answer1 = $skillexp / 250; $answer = round($answer1); $theExp = "" . $skill . "Exp"; $theLevel = "" . $skill . "Lvl"; //end exp hand. include('connect.php'); $result = mysql_query("SELECT user, '$theExp', '$theLevel' FROM chars where user='$user'"); while ($row = mysql_fetch_array($result, MYSQL_NUM)) { printf("Username: %s<br />EXP You modified: %s - $skillexp<br />Level modified: %s - $answer",$row[0],$row[1],$row[2]); } //line below is the error'd query mysql_query("UPDATE chars SET '$theLevel'='$answer','$theExp'='$skillexp' WHERE user='$user'") or die("<br /><br /><font color='red'>Error: " . mysql_error()); ?> What is wrong with the query I am using? Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/219042-error-you-have-an-error-in-your-sql-syntax-check-the-manual-that-corresponds-t/ Share on other sites More sharing options...
Pikachu2000 Posted November 18, 2010 Share Posted November 18, 2010 If you're going to enclose the field and/or table names, use `backticks`, not quotes . . . Quote Link to comment https://forums.phpfreaks.com/topic/219042-error-you-have-an-error-in-your-sql-syntax-check-the-manual-that-corresponds-t/#findComment-1135931 Share on other sites More sharing options...
Username: Posted November 18, 2010 Author Share Posted November 18, 2010 If you're going to enclose the field and/or table names, use `backticks`, not quotes . . . Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/219042-error-you-have-an-error-in-your-sql-syntax-check-the-manual-that-corresponds-t/#findComment-1135932 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.