0

Hi i am retrieving data from database in php when i retrieve vale i am getting following warning

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

here is my code

<?php
session_start();
require_once("configure.php");
if (!(isset($_GET['pagenum']))) { 
     $pagenum = 1; 
} else {
    $pagenum = $_GET['pagenum'];        
}

$page_limit =  ($_GET["show"] <> "" && is_numeric($_GET["show"]) ) ? $_GET["show"] : 5;
$eid=$_SESSION['eid'];

$sql="SELECT * FROM `clientreg` WHERE eid=$eid and nextcalling=curdate()";

$cnt = mysql_num_rows( mysql_query($sql));

$last = ceil($cnt/$page_limit); 

if ($pagenum < 1) { 
    $pagenum = 1; 
} elseif ($pagenum > $last)  { 
    $pagenum = $last; 
}
$lower_limit = ($pagenum - 1) * $page_limit;
$sql2 = $sql . " limit ". ($lower_limit)." ,  ". ($page_limit). " ";
$rs = mysql_query($sql2);   

    while ( $row = mysql_fetch_array($rs) ) {
 echo $row["mobile"];
}
    ?>

i am getting this warning when nextcallingdate is'0000-00-00' in database aur any other date expect current date

How can i achieve my goal how can i handling this warning

Any help will be appreciated

kunal rajawat
  • 39
  • 1
  • 8
  • Should I wait till the time someone jumps in to get some quick reputation or go ahead close it now? In case you were wondering; this problem has 1 million duplicates all over the web already – Hanky Panky Sep 09 '14 at 08:44

1 Answers1

0

Probably mysql_query($sql2) has failed. Add the folowing code below $rs = mysql_query($sql2):

if (!$rs) die("Error quering database!");
cezar
  • 600
  • 3
  • 10