The sql_showbase() function is used to obtain a resource that can be used with sql_fetch() detailing the tables that exist in the database.

It accepts 3 parameters:

  1. $spip empty by default, the parameter is used to list only the tables using the prefix defined for SPIP tables. Use '%' instead if you want to list ALL tables,
  2. $serveur,
  3. $option.


if ($q = sql_showbase()) {
    while ($t = sql_fetch($q)) {
        $table = array_shift($t);
        // ...

The sql_alltable function is generally easier to use, since it directly returns a PHP array listing the various database tables.

Author Mark Baber Published : Updated : 02/06/10

Translations : English, français