RE: [PHP-DB] Re: create tables in mysql with php??
| From: | Matthew Loff | Date: | Sun, 12 Aug 2001 03:53:22 +0000 |
| Subject: | RE: [PHP-DB] Re: create tables in mysql with php?? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-11260@lists.php.net to get a copy of this message | ||
Are you using the same mysql username/password in the PHP script as you
are in the mysql client?
If you're logged into your unix box as root, and run the mysql client
without any parameters, it'll try to connect to the db as 'root'.
-----Original Message-----
From: Jon Cheng [mailto:joncheng2000@yahoo.com]
Sent: Saturday, August 11, 2001 10:25 PM
To: cczona@nospam.invalid; php-db@lists.php.net
Subject: Re: [PHP-DB] Re: create tables in mysql with php??
I am using this;
mysql_query("create table ".$course_array[$i]." (CourseID char(8) not
null, CourseTitle varchar(40), CourseTime varchar(255) not null)");
I echo the string inside the mysql_query() brackets, and I copy and
pasted
into:
mysql>create table csc (CourseID char(8) not null, CourseTitle
mysql>varchar(40),
CourseTime varchar(255) not null);
Query OK, 0 rows affected (0.05 sec)
mysql>
so putting it in manually works, but not from a query. Is there a silly
syntactic error I am making?
thanks,
-Jon
----- Original Message -----
From: "CC Zona" <cczona@nospam.invalid>
To: <php-db@lists.php.net>
Sent: Saturday, August 11, 2001 9:55 PM
Subject: [PHP-DB] Re: create tables in mysql with php??
> In article <001901c122d1$6f5c1720$0200a8c0@joncheng>,
> joncheng2000@yahoo.com (Jon Cheng) wrote:
>
> > hello all, is there ANYWAY to create a new table in mysql with php?
>
> Sure. It's a query, you submit it just like any other. If you're
> getting
> errors:
>
> (A) be sure the username in your mysql_connect() call has sufficient
> privileges to create the table,
>
> (B) check with the MySQL manual to confirm that your "create"
> statement is syntactically correct, and /or
>
> (C) call mysql_error() to find out what MySQL is choking on.
>
> --
> CC
>
> --
> 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
>
--
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