Jellicle Posted February 2, 2012 Share Posted February 2, 2012 Chaps I'm trying to run a query constructed from values passed in a URL. The URL looks like this: http://domain.com/scripts/listrecords.php?state=NT&suburb=Darwin In my php file I do this: $query = "select * from dogs where state = '".mysql_real_escape_string($_GET['state'])."' AND suburb = '".mysql_real_escape_string($_GET['suburb'])."'; When I do just: $query = "select * from dogs where state = '".mysql_real_escape_string($_GET['state'])."' It works. But when I add the second variable it doesn't. What am I doing wrong? Jellicle Link to comment https://forums.phpfreaks.com/topic/256253-using-variables-passed-in-the-url-to-construct-a-query/ Share on other sites More sharing options...
Jellicle Posted February 2, 2012 Author Share Posted February 2, 2012 Solved. Bloody quote was missing from the end of the query. Phew. J Link to comment https://forums.phpfreaks.com/topic/256253-using-variables-passed-in-the-url-to-construct-a-query/#findComment-1313658 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.