bravo14 Posted June 6, 2012 Share Posted June 6, 2012 Hi I cant see what is wrong with this but I am getting the error above <?php if(isset($post_id)){ echo ('<h1>'.$post['title'].'</h1>'.$post['content']); } else { //search all blog table $blog_sql=mysql_query("SELECT * FROM `tbl_blog` order by `post_date_time` desc") or die(mysql_error()); if(mysql_num_rows($blog_sql==0)){ //line 127 echo "There are no blog posts yet"; } else { echo('<table> <tr><td>Date</td><td>Intro</td></tr>'); while($blog_row=mysql_fetch_assoc($blog_sql)){ echo('<tr><td>'.$blog_row['datetime'].'</td><td>'.$blog_row['intro'].'</td></tr>'); } echo('</table>'); } } ?> The query generates a result with zero rows in the database,which is correct. Link to comment https://forums.phpfreaks.com/topic/263781-warning-mysql_num_rows-expects-parameter-1-to-be-resource/ Share on other sites More sharing options...
ejay Posted June 6, 2012 Share Posted June 6, 2012 replace if(mysql_num_rows($blog_sql==0)){ with if(mysql_num_rows($blog_sql)==0){ Link to comment https://forums.phpfreaks.com/topic/263781-warning-mysql_num_rows-expects-parameter-1-to-be-resource/#findComment-1351748 Share on other sites More sharing options...
bravo14 Posted June 6, 2012 Author Share Posted June 6, 2012 Thanks, feel stupid, I was looking at it for ages Link to comment https://forums.phpfreaks.com/topic/263781-warning-mysql_num_rows-expects-parameter-1-to-be-resource/#findComment-1351749 Share on other sites More sharing options...
ejay Posted June 6, 2012 Share Posted June 6, 2012 it happens sometimes Link to comment https://forums.phpfreaks.com/topic/263781-warning-mysql_num_rows-expects-parameter-1-to-be-resource/#findComment-1351751 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.