[RESOLVED] Checking if a MySQL Table exists?
Okay I have this:
PHP Code:
$tables = mysql_list_tables($db['dbname']);
$num_tables = @mysql_numrows($tables);
$i = 0;
$exist = 0;
while($i < $num_tables)
{
$tablename = mysql_tablename($tables, $i);
}
if ($tablename=='ForumConfig') {
$exist=1;
$i++;
}
if ($exist==0)
{
die ("Please check your database connection and/or install MageBB.");
}
However it just times out...
Basically it's checking if a table exists, and if not, it will "die". Does anybody know a different way?? Or is the code just wrong? :ehh:
Rudi :wave:
Re: Checking if a MySQL Table exists?
Do a mysql_query() method (or die()) with the SQL:
SHOW TABLES LIKE 'mytablename'
Re: Checking if a MySQL Table exists?