note 44661 added to function.mysql-query
| From: | dan at mlodecki dot net | Date: | Thu, 12 Aug 2004 12:12:45 +0000 |
| Subject: | note 44661 added to function.mysql-query | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-74533@lists.php.net to get a copy of this message | ||
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 ...";
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.mysql-query.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+44661
Delete -- http://master.php.net/manage/user-notes.php?action=delete+44661&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+44661&report=yes
Search -- http://master.php.net/manage/user-notes.php