Hi all, I am facing this problem pleasel help me Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\Program Files\wamp\www\dialedge\show.php on line 48
my code is <?php $dt=$_REQUEST['date']; $dt2=$_REQUEST['date2']; $st=$_REQUEST['status']; $select_val=$_POST['select_val']; echo $val_count=count($select_val); $qry=""; for($i=0;$i<=$val_count;$i++) { if($qry=="") $qry = $select_val[$i]; else $qry .= "," .$select_val[$i]; } if ($st=="all") { echo $rs=mysql_query("SELECT $qry FROM dialedge_list left join dialedge_log on dialedge_list.phone_number=dialedge_log.phone_number where dialedge_log.call_date >='$dt' and dialedge_log.call_date <= '$dt2'"); } else { echo $rs = mysql_query("SELECT $qry FROM dialedge_list left join dialedge_log on dialedge_list.phone_number=dialedge_log.phone_number where dialedge_log.call_date >='$dt' and dialedge_log.call_date <= '$dt2' and dialedge_log.status='$st'"); } if(mysql_num_rows($rs)>0) //if(mysql_fetch_array($rs)) { //echo "<a href='excell.php?id=$st'>Download excell format</a>"; echo "<table width='98%' border='0' cellpadding='5' cellspacing='2' class='tab-bg' >"; $rt =explode(',' ,$qry); for($j=0;$j<$val_count;$j++) { echo "<th bgcolor='#E7E7E7'><span class='font'>".$rt[$j]."</span></th>"; } while($row=mysql_fetch_array($rs)) { echo "<tr>"; for($k=0;$k<$j;$k++) { echo "<td bgcolor='#E7E7E7' ><span class='font1'>".$row[$k]."</span></td>"; } echo "</tr>"; } echo "</table>"; } else { echo "<b>"."<font size=3 color=#CC0000 face=Verdana>"."No Matching Records..................."."</font>"."</b>"."<br>"; ?><input type="button" value="<< Back to Search" onclick="self.location='index.php'"> <?php } mysql_close($con); ?>
Change all occurrences of: mysql_query("QUERY"); to mysql_query("QUERY") or die (); And give us the error. Peace,