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.

Link to comment
Share on other sites

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);

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.