I'm new to php and i need some help.
I wrote a script that supposed to count the number of records with the same value and show them in webpage, yes it is grouping the records with the same value but it is not able to show how many records is existing. I am calling to the advance programmers here...please help or i get fired..
here is the code:
$query = "SELECT SearchString,Count(SearchID)
FROM SearchString
GROUP BY SearchString";
$result = odbc_exec($conn,$query);
// Print out result
while($fetch=odbc_fetch_array($result)){
echo "There area total of ". $fetch[count($fetch)] ." Searches for ". $fetch['SearchString'] .".";
echo "<br />";
}
and here are the results:
There area total of Searches for bcg.
There area total of Searches for BCL.
There area total of Searches for betlog.
There area total of Searches for birthday.
There area total of Searches for build.
There area total of Searches for celebrants.
which supposed to return this:
There area total of [count of records] of Searches for bcg.
There area total of [count of records] Searches for BCL.
There area total of [count of records] Searches for betlog.
There area total of [count of records] Searches for birthday.
There area total of [count of records] Searches for build.
There area total of [count of records] Searches for celebrants.
Please help or i get fired.. please im begging..