Re: Re: create tables in mysql with php??

From: Date: Sun, 12 Aug 2001 04:10:50 +0000
Subject: Re: Re: create tables in mysql with php??
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-11261@lists.php.net to get a copy of this message
Yes you are close Matt, but it turns out that I didn't grant my own user of the database the "create" permission. (althought I thought I have) I am sorry to have bothered you guys for something as silly as this. I have my learnt my lesson. Use mysql_error() everywhere and error check everything! cheers, -Jon ----- Original Message ----- From: "Matthew Loff" <matt@willetts.com> To: "'Jon Cheng'" <joncheng2000@yahoo.com>; <cczona@nospam.invalid>; <php-db@lists.php.net> Sent: Saturday, August 11, 2001 11:53 PM Subject: RE: [PHP-DB] Re: create tables in mysql with php?? > > 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 > > > -- > 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 >

« previous php.db (#11261) next »