Problem displaying results of count query
Posted: Wed Mar 12, 2008 8:11 am
Good Afternoon,
I am having a slight issue displaying the results of a count query. I have tested it in the SQL section of PHPmyAdmin and the query runs fine and gets 5 results and the appropriate counts.
Here is my SQL Query~:
I am displaying the results with:
I have tried removing the date function but that does not seem to be the problem.
Any assistance would be much appreciated
I am having a slight issue displaying the results of a count query. I have tested it in the SQL section of PHPmyAdmin and the query runs fine and gets 5 results and the appropriate counts.
Here is my SQL Query~:
Code: Select all
$query="select COUNT(orderid),employee.username from orders, employee where employee.username = orders.username AND `date` BETWEEN '" . $date1 . "' AND '" . $date2 . "' Group BY orders.username";
$result=@mysql_query($query,$connection)
or die("Unable to perform query<br>$query");Code: Select all
<?php
while($row= mysql_fetch_array($result))
{
?>
<tr>
<td> </td>
<td><?php echo $row['employee.username']?></td>
<td><?php echo $row['COUNT(orderid)'] ?></td>
<td> </td>
<td> </td>
</tr>
<?php
}
?>Any assistance would be much appreciated