Jump to content

Warning: mysql_num_rows() expects parameter 1 to be resource


bravo14

Recommended Posts

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.