Jump to content

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given i


rabesh

Recommended Posts

<?php    
$limit=12;
if(isset( $_GET['page']))
      $page=$_GET['page'];
      if($page<=0) $page = 1;
      
      else {$start=0;}
   $sql=mysql_query('select * from tbl_gallery where status=1 AND category_name="0"');
   $count=mysql_num_rows($sql);
   $totalcount=ceil($count/$limit);
   $start=($page-1)*$limit;
   $s=mysql_query('select * from tbl_gallery where status=1 AND category_name="0" limit $start, $limit');
   while($result=mysql_fetch_array($s)){
      $start++;
      
?>

 

MOD EDIT: code tags added.

That error indicates that a query failed. I don't see anywhere in that code where you make a connection to the database. Is that done somewhere else in the script?

 

One problem you have is that variables are not interpolated in single quoted strings, so the query should be rewritten using double quotes to enclose it.

 

$query = "select * from tbl_gallery where status=1 AND category_name='0' limit $start, $limit";
$s=mysql_query($query);

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.