alexville Posted April 4, 2006 Share Posted April 4, 2006 Hello,I am getting an error when I try to run this query: [code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Chnage your account on dsfdsfsfsfs Game</title><style type="text/css"><!--body { background-color: #CCCCCC;}.style1 {font-family: Tahoma}--></style></head><body><?php// Get the 'username' varible from flash$username = $_POST['username'];$password = $_POST['password'];$clueone = $_POST['clueone'];$cluetwo = $_POST['cluetwo'];$cluethree = $_POST['cluethree'];$dbcnx = @mysql_connect("localhost","fdsfdsfs","dsfsfsfs");if (!$dbcnx) {echo "<p>Unable to connect to the database server at this time.</p>";exit();}mysql_select_db("alexg_web",$dbcnx);$result = @mysql_query("UPDATE whoamipeople SET Clue = '$clueone', Cluetwo = '$cluetwo', Cluethree = '$cluethree' WHERE Username = '$username', Password = '$password'");if (!$result) {exit("<p>Error performing query: " . mysql_error() . "</p>");}?><p><a href="http://dsfsfsfsfs" class="style1">Click here to login </a></p></body></html>[/code]This error is what I get:[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Error performing query: 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 ' Password = ''' at line 1[/quote]What am i'm doing wrong?Mysql version = 4.1.14-standard Link to comment https://forums.phpfreaks.com/topic/6612-what-am-i-doing-wrong-here/ Share on other sites More sharing options...
ToonMariner Posted April 4, 2006 Share Posted April 4, 2006 WHERE Username = '$username' [b]AND[/b] Password = '$password'"); Link to comment https://forums.phpfreaks.com/topic/6612-what-am-i-doing-wrong-here/#findComment-24015 Share on other sites More sharing options...
wildteen88 Posted April 5, 2006 Share Posted April 5, 2006 I would recommend you to put back ticks around the word Password in your mysql query as password a predefined function in mysql and so m ysql is getting confused so if you add back ticks around it then your query should pass through:[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][color=green]WHERE[/color] Username[color=orange]=[/color][color=red]'$username'[/color] [color=blue]AND[/color] `Password`[color=orange]=[/color][color=red]'$password'[/color]" [!--sql2--][/div][!--sql3--] Link to comment https://forums.phpfreaks.com/topic/6612-what-am-i-doing-wrong-here/#findComment-24132 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.