I am using the following code to generate a list in the sidebar that does searches based on the contents of the status field.
What I would like to do is modify this so the results it shows are only those of the found set. Currently, it shows all the results (counts) in the table.
global $conn;
$mess="";
$rstt = CustomQuery("SELECT Contacts.Status, Count(Contacts.Status) AS CountOfStatus FROM Contacts GROUP BY Contacts.Status");
while($data=db_fetch_array($rstt))
{
$StatusName = str_replace(" ","+",$data["Status"]);
$mess.=" <a href=\"Contacts_list.php?ctlSearchFor=" . $StatusName . "&srchOptShowStatus=0&ctrlTypeComboStatus=0&srchWinShowStatus=0&a=integrated&id=1&criteria=and&value11=" . $StatusName . "&field1=Status&option1=Equals\">" . $data["Status"] . " (" . $data["CountOfStatus"] . ")" . "</a>
";
}
$xt->assign("Statusvalue",$mess);
Thank you.