...

View Full Version : fetching data using "mysql_fetch_assoc"



zodehala
03-08-2008, 09:26 PM
i can fetch data using mysql_fetch_array in SHOW TABLE STATUS (http://dev.mysql.com/doc/refman/5.0/en/show-table-status.html) command but why can not i fetch data using mysql_fetch_assoc ?





$con = mysql_connect("localhost", "root", "123") or die(mysql_errno()."<br/>". mysql_error());
mysql_select_db("forum",$con);
$sql = "SHOW TABLE STATUS FROM forum";
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)) {
echo $row["Name"];
echo $row["Engine"];
echo $row["Data_length"];
}
how can i fetch table calles user' properties using this parameter
http://dev.mysql.com/doc/refman/5.0/en/show-table-status.html

Inigoesdr
03-09-2008, 08:47 AM
how can i fetch table calles user' properties using this parameter
You can specify the table with the LIKE clause:

// you shouldn't need the "FROM forum" part, but if it doesn't work try adding it before the LIKE
$sql = "SHOW TABLE STATUS LIKE 'user'";

zodehala
03-09-2008, 12:27 PM
You can specify the table with the LIKE clause:

// you shouldn't need the "FROM forum" part, but if it doesn't work try adding it before the LIKE
$sql = "SHOW TABLE STATUS LIKE 'user'";


thanx it runs but i want to do this proccess all tables in db (using SHOW TABLE STATUS command)

Inigoesdr
03-09-2008, 06:09 PM
Your original code should work fine, then.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum