jwk811 Posted April 21, 2009 Share Posted April 21, 2009 $thumbnail = "http://www.sportquadchat.com/images/avatars/" . $thumbnail; $sql = "UPDATE chat_users SET picture_url = '$thumbnail' WHERE id = $userId"; the thumbnail itself will submit just fine. its when i add the url to the beginning and i get this 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 'b1aafd32d4c8cdaf02ad8bc47365d4b9.jpg'' WHERE id = 33' at line 2 i tried changing it around but i cant figure out why it wont work. Link to comment https://forums.phpfreaks.com/topic/155102-easy-cant-figure-out-how-to-put-a-url-in-the-database-without-error/ Share on other sites More sharing options...
Mchl Posted April 21, 2009 Share Posted April 21, 2009 It's not easy if you can't figure it out obviously. Can you post whole $sql content? Link to comment https://forums.phpfreaks.com/topic/155102-easy-cant-figure-out-how-to-put-a-url-in-the-database-without-error/#findComment-815863 Share on other sites More sharing options...
soak Posted April 21, 2009 Share Posted April 21, 2009 try: $thumbnail = mysql_real_escape_string("http://www.sportquadchat.com/images/avatars/" . $thumbnail); Link to comment https://forums.phpfreaks.com/topic/155102-easy-cant-figure-out-how-to-put-a-url-in-the-database-without-error/#findComment-815867 Share on other sites More sharing options...
avvllvva Posted April 22, 2009 Share Posted April 22, 2009 What is the table field type ???? if it is VARCHAR , change it to TEXT.... then try. Link to comment https://forums.phpfreaks.com/topic/155102-easy-cant-figure-out-how-to-put-a-url-in-the-database-without-error/#findComment-816178 Share on other sites More sharing options...
Yesideez Posted April 22, 2009 Share Posted April 22, 2009 Why has no-one suggested urlencode() yet? http://uk.php.net/urlencode Then when pulling it from the database use urldecode() http://uk.php.net/manual/en/function.urldecode.php VARCHAR is perfectly fine - just make sure it is set long enough to hold a decent URL. Link to comment https://forums.phpfreaks.com/topic/155102-easy-cant-figure-out-how-to-put-a-url-in-the-database-without-error/#findComment-816189 Share on other sites More sharing options...
Mchl Posted April 22, 2009 Share Posted April 22, 2009 Why has no-one suggested urlencode() yet? There's hardly need for that in this case... There seems to be nothing that would break the query here. We don't know what is in $thumbnail however. Link to comment https://forums.phpfreaks.com/topic/155102-easy-cant-figure-out-how-to-put-a-url-in-the-database-without-error/#findComment-816317 Share on other sites More sharing options...
Yesideez Posted April 22, 2009 Share Posted April 22, 2009 Good point - $thumbnail hasn't been verified although going by the sample query IN the OP's post I presumed it was standard text (part of the URL) Link to comment https://forums.phpfreaks.com/topic/155102-easy-cant-figure-out-how-to-put-a-url-in-the-database-without-error/#findComment-816318 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.