tomtimms Posted April 22, 2010 Share Posted April 22, 2010 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 More sharing options...
tomtimms Posted April 22, 2010 Author Share Posted April 22, 2010 Nevermind, I figured out my issue...stupid '' missing. Link to comment https://forums.phpfreaks.com/topic/199423-mysql-query-issue/#findComment-1046643 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.