Jump to content

error from script


rughead101

Recommended Posts

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 99

Found 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">
<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

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.