redgunner Posted September 15, 2010 Share Posted September 15, 2010 if(!$seldb) { // Show error if we cannot connect. echo 'ERROR: Could not connect to the database.'; } else { // Is there a posted query string? if(isset($_POST['queryString'])) { $queryString = mysql_real_escape_string($_POST['queryString']); //this’s the old code ($db->real_escape_string($_POST['queryString']) if(strlen($queryString) >0) { $query = mysql_query('SELECT value FROM countries WHERE value LIKE ‘$queryString%’ LIMIT 10'); if($query) { while ($row = mysql_fetch_assoc($query)){//$query ->fetch_object()) { foreach( $row as $v ) { echo ”.$v.”; } } } else { echo 'ERROR: There was a problem with the query.'; } } else { // Dont do anything. } // There is a queryString. } else { echo 'There should be no direct access to this script!'; } } I keep getting There was a problem with the query on PHP4... Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/213444-query-issue/ Share on other sites More sharing options...
trq Posted September 15, 2010 Share Posted September 15, 2010 Your using strange quotes around $querystring Quote Link to comment https://forums.phpfreaks.com/topic/213444-query-issue/#findComment-1111237 Share on other sites More sharing options...
chintansshah Posted September 15, 2010 Share Posted September 15, 2010 Please use below sql string. $query = mysql_query('SELECT value FROM countries WHERE value LIKE "'.$queryString%.'" LIMIT 10'); Quote Link to comment https://forums.phpfreaks.com/topic/213444-query-issue/#findComment-1111255 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.