denoteone Posted March 16, 2010 Share Posted March 16, 2010 I am looking at the table named price2 and it is completely empty so why when I query the database is show that my result variable is set :confused: $store_info = $_GET['id']; $sql = "SELECT * FROM price2 WHERE price2.storeID = '$store_info'"; $results = $db->query($sql); if(!isset($results)){ [i]no return[/i] on my sql query }else if (isset($results)){ means that there is a return on my sql query } just to make sure I also did while($row = mysql_fetch_assoc($results)){ echo "test"; } just to see and no test are echoed Quote Link to comment https://forums.phpfreaks.com/topic/195456-query-is-showing-set-when-the-table-is-empty/ Share on other sites More sharing options...
scvinodkumar Posted March 17, 2010 Share Posted March 17, 2010 I think you should not use isset, since the mysql_query functions returns true on success and false on failure. so the variable $results always set to either 1 or 0. U better use like this if(!$results){.... Quote Link to comment https://forums.phpfreaks.com/topic/195456-query-is-showing-set-when-the-table-is-empty/#findComment-1027443 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.