On Mon, 9 Feb 2009 19:22:47 +0000 (UTC), "ArizonaJohn"
<webforumsuser (AT) macromedia (DOT) com> wrote:
Quote:
My goal is to search the table names, but then print the contents of the
table that matches the search.
Any ideas on how I can do this?
Thanks, |
You're welcome, John. Untested code, so beware of typos:
$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>Table: $table[0]</p>\n";
$r=mysql_query("SELECT * FROM `$table[0]`");
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