I am trying to use a database i have successfully set up in xampp's phpMyAdmin (screen shot attached) but using the following code, I can't get ANY mysql_query results.
... maybe xampp has a limit on the number of tables or something? Because I can find no other reason for my script not to work?? Or maybe you can? It's been a hair-tearing time trying to suss this one:mad:
PHP Code:
function count_ads($make)
{
$sql = "SELECT * FROM `adverts` WHERE `make`='$make'";
$res = mysql_query($sql) or die(mysql_error());
$result = mysql_num_rows($res);
}
foreach ($cat_array as $make)
{
// Search by Make(Category) and get numbers...
$topic_foreach = $make;
$single_class_records_total = count_ads($make);
if ($single_class_records_total == NULL) $single_class_records_total = 0;
if ($topic_get != "RECENT" && $topic_get == array_search($topic_foreach, $cat_array))
{
echo("<td class=\"classification_2\" ><a href=\"" . $_SERVER["PHP_SELF"] . "?topic_get=$topic_number\">  $topic_foreach   ($single_class_records_total)</a> </td>");
}
else
{
echo("<td class=\"classification_1\" ><a href=\"" . $_SERVER["PHP_SELF"] . "?topic_get=$topic_number\">  $topic_foreach   ($single_class_records_total)</a> </td>");
}
$topic_number++;
if ($topic_number != count($cat_array) && substr_count($topic_number/6, ".") == 0)
{
echo("</tr>
<tr>");
}
else if ($topic_number == count($cat_array) && substr_count($topic_number/6, ".") > 0)
{
echo("<td class=\"empty\"> </td></tr>");
}
else if ($topic_number == count($cat_array) && substr_count($topic_number/6, ".") == 0)
{
echo("</tr>");
}
}
}