Better late then never! :)
I played around with your code tonight and got this working on a
test server:
<?PHP
$db_billing = mysql_connect($DBHOST, $DBUSER, $DBPASS) or die("Could
not connect: " .mysql_error());
$db_selected = mysql_select_db($DB, $db_billing);
if(!$db_selected) {
die("Can't use database: " . mysql_error());
}
if (!$db_billing) { die('Could not connect: ' . mysql_error()); }
$sql = "SHOW TABLES";
$result = mysql_query($sql) or die("query failed:
" .mysql_error());
$resulttest = mysql_fetch_assoc($result);
foreach($resulttest as $k => $v) { //line 62
$ssql = "DESCRIBE ".mysql_real_escape_string($v);
$rresult = mysql_query($ssql);
echo "<b>".$k."</b>:<br />\n";
echo "<pre>\n";
print_r(mysql_fetch_assoc($rresult));
echo "</pre>\n";
echo "<br />\n";
}
?>
The only big difference from what you had is that I moved the
mysql_fetch_assoc($result); into a separate line rather then running
it from the foreach...
Let me know if that helps.
Thanks Jason :-)
What you just offered just shows info about only the first column in
the table.
I got this working to show info about all the columns in the table:
$ssql = "DESCRIBE billing_table";
$rresult = mysql_query($ssql);
echo "<hr /><pre>\n";
while ($row = mysql_fetch_assoc($rresult)) {
print_r($row); //line 278
}
echo "</pre>\n";
echo "<hr />\n";
-G