LemonInflux Posted March 15, 2008 Share Posted March 15, 2008 <?php function tables() { $sql = "SHOW TABLES FROM `test`"; $result = mysql_query($sql) or die(mysql_error()); $tableArray = array(); while ($row = mysql_fetch_row($result)) { echo $row[0] ."\n"; $tableArray[] = $row[0]; } echo $tableArray; mysql_free_result($result); } ?> Prints something similar to: categories config posts topics Array 'categories config posts topics' are the tables in 'test'. Array is the empty array. why is it empty? Thanks in advance, Tom Quote Link to comment Share on other sites More sharing options...
Barand Posted March 15, 2008 Share Posted March 15, 2008 You can't just echo an array - it always gives "Array" echo '<pre>', print_r($tableArray, 1), '</pre>'; Quote Link to comment Share on other sites More sharing options...
LemonInflux Posted March 15, 2008 Author Share Posted March 15, 2008 Oh, that's so embarassing! Haha, I knew that >_< Thanks very much! Topic solved! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.