On Thu, 12 Feb 2009 01:51:54 +0000 (UTC), "ArizonaJohn"
<webforumsuser (AT) macromedia (DOT) com> wrote:
Quote:
Thanks for the help. When I try the code you suggest, it gives me this error:
Parse error: syntax error, unexpected T_FOREACH
It looks like the "foreach" loop is not working. Any ideas? |
Well, I told you it was untested. ;-) It was missing a semicolon at the
end of the line preceding the inner foreach. I had also neglected to print
the opening <table> tag. This one is tested and works:
$result=mysql_query("SHOW TABLES FROM sand2 LIKE '%$find%'")
or die(mysql_error());
if(mysql_num_rows($result)>0){
while($table=mysql_fetch_row($result)){
print "<p style=\>Table: $table[0]</p>\n";
$r=mysql_query("SELECT * FROM `$table[0]`");
print "<table>\n";
while($row=mysql_fetch_row($r)){
print "<tr>";
foreach($row as $field){
print "<td>$field</td>";
}
print "</tr>\n";
}
print "</table>\n";
}
}else{
print "None found";
}
Gary