rughead101 Posted December 10, 2013 Share Posted December 10, 2013 Hi, I am getting this error when I search for a subcatagory, I have uploaded the previous code that links to this script also, any help would be appreciated as i have spent alot of time trying to figure out whats going wrong. Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/marbella/public_html/intranet/getclientsbysource.php on line 99Found sources. Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/marbella/public_html/intranet/getclientsbysource.php on line 110 <?php include("connex.php"); //get values $source=$_GET['src']; $specific=$_GET['sps']; $status=$_GET['st']; $datefrom=$_GET['df']; $dateto=$_GET['dt']; $clienttype=$_GET['ct']; $inc=1; switch ($status) { case 1: $thestatus="Active"; break; case 2: $thestatus="Slow"; break; case 3: $thestatus="No Response"; break; case 4: $thestatus="Dead"; break; case 5: $thestatus="New"; break; case 9: $thestatus="Hot"; break; case 10: $thestatus="Await Resp"; break; case 11: $thestatus="Sale"; break; case 0: default: $thestatus="All"; $inc=0; break; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> </head> <body> <h2><? echo $therep; ?> - Client Report</h2> <h3>Showing: <? echo $thestatus; ?> clients<? if ($datefrom) { echo " registered between ".$datefrom." and ".$dateto; } ?>.</h3> <? if($source==99){ //Selected All sources $resultsSQL="SELECT i_leadsource.leadsource, i_clients.clientsourcespecific, count(leadsource) as total FROM `i_clients` INNER JOIN i_leadsource ON i_clients.clientsource=i_leadsource.leadsourceid WHERE clientsource<>''"; }else{ //Selected single source $resultsSQL="SELECT i_leadsource.leadsource, i_clients.clientsourcespecific, count(leadsource) as total FROM `i_clients` INNER JOIN i_leadsource ON i_clients.clientsource=i_leadsource.leadsourceid WHERE clientsource<>'' AND i_leadsource.leadsourceid=".$source; } $isspecific="clientsourcespecific"; if(strpos($specific, ")")>4) { $resultsSQL.=" AND clientsourcespecific IN ".$specific; $isspecific="clientsource"; } if(isset($clienttype) && $clienttype<>0) { $resultsSQL.=" AND clienttype=".$clienttype; } if($inc==1) { $resultsSQL.=" AND clientstatus=".$status; } if($datefrom) { $resultsSQL.=" AND regdate between '".$datefrom."' and '".$dateto."'"; } switch($_GET['or']) { case "2": $resultsSQL.=" GROUP BY ".$isspecific." ORDER BY total;"; break; case "3": if($source==99) { $resultsSQL.=" GROUP BY ".$isspecific." ORDER BY clientsource;"; }else{ $resultsSQL.=" GROUP BY ".$isspecific." ORDER BY clientsourcespecific;"; } break; default: $resultsSQL.=" GROUP BY ".$isspecific." ORDER BY total;"; } $results=mysql_query($resultsSQL,$ent); $x=mysql_num_rows($results); // While start ?> <p>Found <? echo $x; ?> sources.</p> <table cellpadding="2" cellspacing="0" border="0" width="100%"> <tr class="table_head"> <td>Lead Source</td> <td>Specific Source</td> <td>Count</td> </tr> <? while ($fila=mysql_fetch_array($results)) { ?> <tr> <td><? echo $fila['leadsource']; ?></td> <td><? echo $fila['clientsourcespecific']; ?></td> <td><? echo $fila['total']; ?></td> </tr> <? } ?> </table><p> </p> <? mysql_close($ent); ?> </body> </html> clientsbysource.php Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted December 10, 2013 Share Posted December 10, 2013 this is a very common error. see the following - http://forums.phpfreaks.com/topic/273121-readme-php-resources-faqs/?do=findComment&comment=1428660 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.