stevesimo Posted March 23, 2007 Share Posted March 23, 2007 Hi, I have a database page which all I am trying to do is display a count of all the records contained in the table. Although my code seems to be working the count isn't being returned. Here is my code: $border = mysql_query("SELECT * from orders"); $orders = mysql_fetch_object($border); $results = $orders->num_rows; [code] Can anyone see what is wrong with this as I am not sure what I am doing wrong. Thanks Steve [/code] Link to comment https://forums.phpfreaks.com/topic/43965-solved-problem-getting-search-to-work/ Share on other sites More sharing options...
tauchai83 Posted March 23, 2007 Share Posted March 23, 2007 <?php $total = sql_query1("SELECT count(*) FROM table_name E WHERE conditions"); ?> Link to comment https://forums.phpfreaks.com/topic/43965-solved-problem-getting-search-to-work/#findComment-213442 Share on other sites More sharing options...
Hell Toupee Posted March 23, 2007 Share Posted March 23, 2007 Or without the need for a second query, instead of: $results = $orders->num_rows; it should be: $results = mysql_num_rows($border); Link to comment https://forums.phpfreaks.com/topic/43965-solved-problem-getting-search-to-work/#findComment-213546 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.