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 Link to comment https://forums.phpfreaks.com/topic/91635-check-my-php-mysql-syntax-please/ Share on other sites More sharing options...
pocobueno1388 Posted February 18, 2008 Share Posted February 18, 2008 The error being? Link to comment https://forums.phpfreaks.com/topic/91635-check-my-php-mysql-syntax-please/#findComment-469311 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 Link to comment https://forums.phpfreaks.com/topic/91635-check-my-php-mysql-syntax-please/#findComment-469314 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"); Link to comment https://forums.phpfreaks.com/topic/91635-check-my-php-mysql-syntax-please/#findComment-469317 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 Link to comment https://forums.phpfreaks.com/topic/91635-check-my-php-mysql-syntax-please/#findComment-469327 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. Link to comment https://forums.phpfreaks.com/topic/91635-check-my-php-mysql-syntax-please/#findComment-469332 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 Link to comment https://forums.phpfreaks.com/topic/91635-check-my-php-mysql-syntax-please/#findComment-469336 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.