As mentioned in the Querying with PHP Tutorial, any query that can be used with the MySQL command prompt can be passed as a string variable to the PHP library function mysql_query().
Therefore creating or dropping a table uses the same syntax as that covered in the Create and Drop Tutorial.
As long as the PHP rules on single and double quoted strings are observed, the code is straightforward.
Example of Creating and Dropping a Table
<?php
$query = "CREATE TABLE persons (
id int(6) DEFAULT '0' NOT NULL auto_increment,
firstname varchar(30) NOT NULL,
lastname varchar(30) NOT NULL,
address varchar(100) NOT NULL,
county varchar(40),
country varchar(30) DEFAULT 'UK',
age int(3),
PRIMARY KEY (id)
);";
$result = mysql_query($query, $connection) or exit(mysql_error());
$query = "DROP TABLE persons";
$result = mysql_query($query, $connection) or exit(mysql_error());
?>
Note: When you DROP a table all data within the table is lost and is not recoverable.