Jump to content

[SOLVED] MySQL Error With inserting URL into DB


hellonoko

Recommended Posts

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.