trying to dump out table info

From: Date: Mon, 13 Jul 2009 20:53:16 +0000
Subject: trying to dump out table info
Groups: php.db 
Request: Send a blank email to php-db+get-46290@lists.php.net to get a copy of this message
Hi all I am not sure why this is failing/giving error. I am quite new at PHP/Mysql, and apologize for what will undoubtedly end up being a trivial error on my part. Here is my code: $db_billing=mysql_connect(localhost,metheuser,mypass,billing); if (!$db_billing) { die('Could not connect: ' . mysql_error()); } $sql = "SHOW TABLES"; $result = mysql_query($sql); foreach(mysql_fetch_assoc($result) 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"; } which is giving this error: Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/meee/public_html/somedir/test.php on line 62 I read about: -mysql_fetch_assoc -mysql_query -SHOW TABLES but do not see why this should be failing. Why isn't $result a ' valid MySQL result resource'? -G ------------ Govinda govinda.webdnatalk@gmail.com

« previous php.db (#46290) next »