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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.