View Full Version : Resolved Getting all tables in a database

08-03-2008, 09:30 PM
Right, this is quite complicated. Im wanting to get the names of all the tables in a database. BUT, the code ive got is only showing one out of 10 for some unknown reason. Its basically to make sure theres nothing wrong with the tables in the database.

//We NEED to check that all the tables we use exist (if any mod is applied, you may add your table(s) here):
$TABLES = array("bbcode",

$Q = mysql_query("SHOW TABLES;");
$DATA = mysql_fetch_assoc($Q);

can someone tell me where im going wrong? the array is the names of mandatory tables.

08-03-2008, 09:40 PM
The definition of mysql_fetch_assoc (and for all the mysql_fetch_xxxxx functions) -

Fetch a result row as an associative array

Returns an associative array that corresponds to the fetched row and moves the internal data pointer ahead. Each call returns one row from the result set.

08-17-2008, 06:48 PM
well... is there any other way of getting data from a query without using a fetch_xxxxx as array, assoc, row, field are all giving only one table when i need all 10 or however many there is.

Fixed it, wasnt thinking straight, Needed to add a while loop in.