note 44661 deleted from function.mysql-query by tomsommer
| From: | tomsommer@php.net | Date: | Thu, 12 Aug 2004 13:10:22 +0000 |
| Subject: | note 44661 deleted from function.mysql-query by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-74534@lists.php.net to get a copy of this message | ||
Note Submitter: dan@mlodecki.net
----
Say you want to check if a table exists, and create it if it doesn't...
<?PHP
mysql_connect();
mysql_select_db("database_name");
$SQL = "DESCRIBE eventslog";
if (mysql_query($SQL)) {
echo "table exists";
} else {
echo "table doesn't exist";
$SQL = "CREATE fancy_sql_stuff ...";
}
?>