Here you go:
<?
// //////////////////////////////////////////////////////////////////
// EXAMPLE OF CREATING A MYSQL TABLE WITH PHP
//
//
// //////////////////////////////////////////////////////////////////
// include common routines -- gives the db variables for dbhost, dbuser,
dbpassword, db
include 'zcommon.php';
// Connecting, selecting database
$link = mysql_connect("$dbhost", "$dbuser", "$dbpassword")
or die("System level error: Could not connect to database: at routine
BLAH0: email $sysadminemail");
mysql_select_db("$db")
or die("System level error: Could not select database: at add routine
BLAH1: email $sysadminemail");
// create the insert query
$query = "CREATE TABLE list ( list_id INT NOT NULL PRIMARY KEY
AUTO_INCREMENT ) ";
//picked up this DIE technique from someone on the list.
// Wonderful way to handle bad queries. Recommended. Sorry I can't give
credit.
$result=mysql_query($query) or die ('<H1 align=center><font color=red>Bad
Database Request</font></H2> in :<BR>'
.__FILE__ .' line '.__LINE__
.'<BR><br /><b>The query used was:</b><BR><BR> '.$query
.'<BR><br /><b>MySQL says</b><BR><BR> '.mysql_error()
.'<BR><BR>Email administrator for help at ' . $sysadminemail . ' for
help' );
// Closing connection to the db
mysql_close($link);
?>
* * * * * * * * * * * * * * * * * * * * * * * * * *
J. Scott Johnson
PHP Consulting and Design Work
* * * * * * * * * * * * * * * * * * * * * * * * * *
Virtual:
* * * * * * * * * * * * * * * * * * * * * * * * * *
[EMAIL PROTECTED]
http://www.fuzzygroup.com/
Yahoo IM: fuzzygroup
-----Original Message-----
From: Uma Shankari T. [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 3:51 AM
To: PHP
Subject: [PHP] Create table
Hello,
Can anyone please tell me how to create a table in mysql using php
code..
-Uma
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php