Re: Creating tables
| From: | Subodh Gupta | Date: | Wed, 25 Apr 2001 18:51:05 +0000 |
| Subject: | Re: Creating tables | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-8888@lists.php.net to get a copy of this message | ||
Hi Herman,
I am myself a pro at PHP, but I think, this would be of some help to you.
To create a Table, you won't find a comand in PHP. However what you do is build a CREATE TABLE
statement and pass that as an
argument to mysql_query() function to do the job.
Here is a small example:
mysql_connect($dbhost,$dbuser,$dbpassword) or die("Couldn't Connect);
mysql_select_db($dbname);
$query = "CREATE TABLE YOUR_TABLE (
COL1 INT NOT NULL
PRIMARY KEY,
COL2 TEXT
);
mysql_query($query) or die(mysql_error);
Just a small tip. You can use phpmyadmin utility to these sorts of job in a jiffy.
I hope this helps!
Subodh Gupta
I have learned, Joy is not in things, it is in us.
You will ultimately be known by what you give and not what you get.
----- Original Message -----
From: "Herman Wapenaar" <hwapen@iafrica.com>
To: <php-db@lists.php.net>
Sent: Wednesday, April 25, 2001 11:30 AM
Subject: [PHP-DB] Creating tables
Hi everyone
I am using a website based in the states to which is PHP enabled. I am using
MySQL.
Is there a way to create a table with PHP? I do not see any command for
that.
I have loaded MySQL for Windows but the server runs MySQL on Unix. I don't
know if the file structure is different. Maybe that is why I can not read
it?
Thanks
Herman Wapenaar
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
For additional commands, e-mail: php-db-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net