Hi,
I use this query to give me a list of Agents:
$result = mysql_query("SELECT DISTINCT Agent FROM $today ORDER BY Agent")
and this to display the results:
$number = mysql_numrows($result);
if ($number == 0) {
;
} else
{
$i = 0;
while ($i < mysql_num_rows($result))
{
//Display results of agent search
$Agent[$i] = mysql_result($result, $i, "Agent");
echo $Agent[$i] . "<BR>";
$i++;
}
}
It all works fine.
Now I want to include the reuslts of the above query in a new query.
I want the new query to count then display the number of 'M' values in the field 'Type' for all the Agents. ie. If Agent Dave has 3 rows with M in the type to return 3, and if Agent Jake has two rows with M in the type to return 2.
Now I'm only a beginner at PHP so I knew that my attempt would not work.
$resultm = mysql_query("SELECT COUNT (*) AS Type FROM $today WHERE AGENT='".$Agent['$i']."' AND Type=M ORDER BY Agent");
I would like to display the results below eachother using line breaks.
Please can someone help?
Thanks,
Dave.