Jump to content

[SOLVED] not a valid MySQL result resource Error!


mcerveni

Recommended Posts

When i upload my script to my hosting web server, it gives me this error:

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/u5/mcerveni/html/agentstats/include/lookup.php on line 20

 

 

My code runs fine on my local host though. Here it is:

 


$sql = "SELECT * FROM table WHERE EmpID = '$searchreq' || AgentName = '$searchreq' || AvayaID = '$searchreq' ORDER BY date";
$result = mysql_query($sql);


$sql2 = "SELECT TeamLeader, AgentName, EmpID, AvayaID, date, StaffedTime, AHT , ACDCalls,  ACDTime , AvgACDTime, sum(ACWTime), sum(AvgACWTime),  HoldCalls, HoldTime,  AvgHoldTime,  OutboundCalls , OutboundTime , AvailTime,  RingTime,  AvgRingTime,  AVG(utilization) FROM table WHERE EmpID = '$searchreq' || AgentName = '$searchreq' || AvayaID = '$searchreq'";


$result2 = mysql_query($sql2);

$row2= mysql_fetch_array($result2);


$utilization = $row2['AVG(utilization)'];
$acwTime = $row2['sum(ACWTime)'];
$avg_acwTime = $row2['sum(AvgACWTime)'];

if(mysql_num_rows($result) == 0) { 
echo 'No records found for: <font color="blue"> '.$_GET['req'];  ' </font>';
}
else {

 

any help please?

$sql = "SELECT * FROM table WHERE EmpID = '$searchreq' || AgentName = '$searchreq' || AvayaID = '$searchreq' ORDER BY date";
$result = mysql_query($sql);

 

|| is for PHP

OR is FOR MySQL

 

$sql = "SELECT * FROM table WHERE EmpID = '$searchreq' OR AgentName = '$searchreq' OR AvayaID = '$searchreq' ORDER BY date";
$result = mysql_query($sql);

Well, it shows this message:

 

  Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause 

 

When i add GROUP BY date. It will not show the avg(utilization) at all. It will just show the first record.

 

If i have ORDER BY date, it will add all the utilization and show the avg properly.

 

here's my code again:

 


$sql = "SELECT * FROM import_stats WHERE EmpID = '$searchreq' || AgentName = '$searchreq' || AvayaID = '$searchreq' ORDER BY date";
$result = mysql_query($sql);


$sql2 = "SELECT TeamLeader, AgentName, EmpID, AvayaID, date, StaffedTime, AHT , ACDCalls,  ACDTime , AvgACDTime, sum(ACWTime), sum(AvgACWTime),  HoldCalls, HoldTime,  AvgHoldTime,  OutboundCalls , OutboundTime , AvailTime,  RingTime,  AvgRingTime,  AVG(utilization) FROM import_stats WHERE EmpID = '$searchreq' || AgentName = '$searchreq' || AvayaID = '$searchreq' ORDER BY date";

$result2 = mysql_query($sql2) or die(mysql_error());

$row2= mysql_fetch_array($result2);


$utilization = $row2['AVG(utilization)'];
$acwTime = $row2['sum(ACWTime)'];
$avg_acwTime = $row2['sum(AvgACWTime)'];

if(mysql_num_rows($result) == 0) { 
echo 'No records found for: <font color="blue"> '.$_GET['req'];  ' </font>';
}
else {

Archived

This topic is now archived and is closed to further replies.

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