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 Link to comment https://forums.phpfreaks.com/topic/96310-whats-wrong-with-this-function/ 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>'; Link to comment https://forums.phpfreaks.com/topic/96310-whats-wrong-with-this-function/#findComment-492974 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! Link to comment https://forums.phpfreaks.com/topic/96310-whats-wrong-with-this-function/#findComment-492978 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.