What's the best way of checking whether a table exists in the database? Is there a function for it in $db, or is there an SQL statement I can use to check, or do I simply use a CREATE TABLE IF NOT EXISTS statement to create the table if it's not there?
This is for something I want to release for free by the way, not a commercial module.
Had to solve this one myself recently. There is very little info online (beyond Nano's suggestion - which seems sledgehammer-to-crack-a-walnut for just 1 table).
Settled on:
$result = $db->sql_query("SHOW TABLES LIKE '".$prefix."\_%\_forums'");
Obviously put whatever you need in the like string, but I left mine in as an example.