hellonoko Posted April 1, 2009 Share Posted April 1, 2009 My script inserts crawled links from a age into my DB. <?php if (mysql_num_rows(mysql_query("SELECT * FROM `secondarylinks` WHERE link = '".mysql_real_escape_string($link)."' LIMIT 1")) == 0) { $query = "INSERT INTO `secondarylinks` ( `link` , `scraped` , `host` ) VALUES ( '".mysql_real_escape_string($link)."'' , '0' , '$site')"; $result = mysql_query($query) or die (mysql_error()); } ?> However I am receiving the following 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 '0' , 'empreintes-digitales.fr')' at line 1 When it tries to insert this url: ?tags=valerie je t'aime Is there something I should do besides mysql_real_escape_string() Before using mysql_real_escape_string() my script would return the URL as aime Any ideas? Quote Link to comment Share on other sites More sharing options...
sdi126 Posted April 1, 2009 Share Posted April 1, 2009 It looks like you have an extra single quote after the $link variable...you have double single quotes which is not what you want...you just need one. Quote Link to comment Share on other sites More sharing options...
hellonoko Posted April 1, 2009 Author Share Posted April 1, 2009 Thanks! That fixed it... 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.