Hello,
I would like the code below to sort the echoed output by votes_up descending. I have added "ORDER BY votes_up DESC" to both queries, but the echoed output is still not sorting. Any ideas why it is not working?
Thanks in advance,
John
I would like the code below to sort the echoed output by votes_up descending. I have added "ORDER BY votes_up DESC" to both queries, but the echoed output is still not sorting. Any ideas why it is not working?
Thanks in advance,
John
Code:
$result = mysql_query("SHOW TABLES FROM feather")
or die(mysql_error());
while(list($table)= mysql_fetch_row($result))
{
$sqlA = "SELECT COUNT(*) FROM `$table` WHERE `site` LIKE '$entry' ORDER BY votes_up DESC";
$resA = mysql_query($sqlA) or die("$sqlA:".mysql_error());
list($isThere) = mysql_fetch_row($resA);
if ($isThere)
{
$table_list[] = $table;
}
}
foreach ($table_list as $table) {
$sql = "SELECT votes_up FROM `$table` WHERE `site` LIKE '$entry' ORDER BY votes_up DESC";
$sql1 = mysql_query($sql) or die("$sql:".mysql_error());
while ($row = mysql_fetch_assoc($sql1)) {
echo $table . ': "' . $row['votes_up'] . " for $entry from $table\"<br />";
}
}
Comment