HighDots Forums  

Searching MySQL table names

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss Searching MySQL table names in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #11  
Old   
Gary White
 
Posts: n/a

Default Re: Searching MySQL table names - 02-12-2009 , 08:40 AM






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


Reply With Quote
  #12  
Old   
ArizonaJohn
 
Posts: n/a

Default Re: Searching MySQL table names - 02-14-2009 , 08:46 PM






Thanks, Gary. Your knowledge is impressive.

-John

Reply With Quote
  #13  
Old   
Gary White
 
Posts: n/a

Default Re: Searching MySQL table names - 02-16-2009 , 12:49 PM



On Sun, 15 Feb 2009 01:46:19 +0000 (UTC), "ArizonaJohn"
<webforumsuser (AT) macromedia (DOT) com> wrote:

Quote:
Thanks, Gary. Your knowledge is impressive.
You're welcome, John. Thanks for the compliment.

Gary


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.