Hello,
The code below echoes the following:
Table Name 1
Table Name 2
Table Name 3
Table Name 4 "$entry": "votes_up for $entry in Table Name 4"
I want it to echo this:
Table Name 1: "votes_up for $entry in Table Name 1"
Table Name 2: "votes_up for $entry in Table Name 2"
Table Name 3: "votes_up for $entry in Table Name 3"
Table Name 4: "votes_up for $entry in Table Name 4"
How could I change the code to make it echo what I want?
The number of Table Names varies based on $entry.
Thanks,
John
$result = mysql_query("SHOW TABLES FROM feather")
or die(mysql_error());
while(list($table)= mysql_fetch_row($result))
{
$sqlA = "SELECT `site`,votes_up FROM `$table` WHERE `site` LIKE '$entry'";
$resA = mysql_query($sqlA) or die("$sqlA:".mysql_error());
if(mysql_num_rows($resA) > 0)
{
$table_list[] = $table;
while($rowA = mysql_fetch_assoc($resA))
{
$votes_up[$rowA["site"]] = $rowA["votes_up"];
}
}
}
foreach( $table_list as $key => $value){
echo "$value <br />";
}
foreach($votes_up as $site => $vote_up)
{
echo "$site: $vote_up";
}