Looktrne Posted February 18, 2008 Share Posted February 18, 2008 can you tell me if there is something wrong with this syntax? I keep getting errors with the syntax $sql = "UPDATE Profiles SET City = '$row[city]', Headline = '$row[name]', LookingFor = '$lf', DescriptionMe = '$desc', DateOfBirth ='$bd', Zip= '$row[zipcode]' WHERE ID='$row[member_id]'"; thanks for any help with this Paul Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted February 18, 2008 Share Posted February 18, 2008 The error being? Quote Link to comment Share on other sites More sharing options...
Looktrne Posted February 18, 2008 Author Share Posted February 18, 2008 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 '7" with straight long hair. I like fashion, so my clothing style is a combinati' at line 5 Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted February 18, 2008 Share Posted February 18, 2008 Do this and copy and paste what you see: <?php $sql = "UPDATE Profiles SET City = '$row[city]', Headline = '$row[name]', LookingFor = '$lf', DescriptionMe = '$desc', DateOfBirth ='$bd', Zip= '$row[zipcode]' WHERE ID='$row[member_id]'"; $result = mysql_query($sql)or die(mysql_error() . "<p>With Query:<br>$query"); Quote Link to comment Share on other sites More sharing options...
Looktrne Posted February 18, 2008 Author Share Posted February 18, 2008 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 '7" with straight long hair. I like fashion, so my clothing style is a combinati' at line 5 With Query: looks the same....I am worried the variable I am uploading does not take... because I am not using stripslashes or whatever... can you tell me how to clean a variable for mysql Paul Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted February 18, 2008 Share Posted February 18, 2008 Thats strange, after the "With Query:" part it was supposed to show your query, and it came out blank...unless you left that part out. to clean a variable for database insertion you want to use mysql_real_escape_string() on it. It will probably solve your problem if you do that to all the variables. Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted February 18, 2008 Share Posted February 18, 2008 That's because the OP's query variable is $sql, not $query. It should be: <?php $result = mysql_query($sql)or die(mysql_error() . "<p>With Query:<br>$sql"); ?> Ken 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.