Jump to content

MYSQL Query Issue


tomtimms

Recommended Posts

I have a query that is searching if something exists in my database.  I have URL's stored in my database and when I tried to run a query to check I get the error:

 

There was an issue with this query: SELECT * FROM sites WHERE url = http://www.mysite.net AND id =3Error: 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 '://www.mysite.net AND id =3' at line 1

 

My query is the following.

 

    $sql = "SELECT * FROM sites WHERE url = ".mysql_real_escape_string($url)." AND id =".$id."";

 

Anyone know why it won't search the whole URL?

Link to comment
https://forums.phpfreaks.com/topic/199423-mysql-query-issue/
Share on other sites

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.