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 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){.... 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
Archived
This topic is now archived and is closed to further replies.