RE: [PHP-DB] How to create table?
pet (name VARCHAR(20) is okay Because he wrote: create table pet ( <-- pet = Table Name name VARCHAR(20), owner ) the query is okay ... But I would allow NULL in the death - column (I donĀ“t know what the default is in MySql) Or is every (!) pet you enter in your table already dead ? => CREATE TABLE pet ( name VARCHAR(20), owner VARCHAR(20), species VARCHAR(20), sex CHAR(1), birth DATE, death DATE NULL )"; > -Original Message- > From: Miles Thompson [SMTP:[EMAIL PROTECTED]] > Sent: Wednesday, August 15, 2001 14:41 > To: [EMAIL PROTECTED] > Subject: Re: [PHP-DB] How to create table? > > Jan, > > to which you add > > $result = mysql_query( $table ); > > which will execute your statement and create the table. > > And I think pet (name VARCHAR(20) > should bepet VARCHAR(20) > > HTH - Miles > > At 02:03 PM 8/15/01 +0200, Jan Grafstrom wrote: > >Hi! > >I have just started to learn about mysql and wonder if my code is good? > > >$connexion = mysql_connect("localhost","login","passwd") or die ("ERROR > >de connexion on Server"); > >print ("Connection ok"); > >mysql_select_db("database_name",$connexion) or die ("Cant find db"); > > > >$table= "CREATE TABLE pet (name VARCHAR(20), owner VARCHAR(20), species > >VARCHAR(20), sex CHAR(1), birth DATE, death DATE)"; > >?> > >Thanks in advance for any help. > > > >Regards > >Jan > > > > > > > >-- > >PHP Database Mailing List (http://www.php.net/) > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > >To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] If you have received this e-mail in error or wish to read our e-mail disclaimer statement and monitoring policy, please refer to http://www.drkw.com/disc/email/ or contact the sender. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] How to create table?
Jan, to which you add $result = mysql_query( $table ); which will execute your statement and create the table. And I think pet (name VARCHAR(20) should bepet VARCHAR(20) HTH - Miles At 02:03 PM 8/15/01 +0200, Jan Grafstrom wrote: >Hi! >I have just started to learn about mysql and wonder if my code is good? >$connexion = mysql_connect("localhost","login","passwd") or die ("ERROR >de connexion on Server"); >print ("Connection ok"); >mysql_select_db("database_name",$connexion) or die ("Cant find db"); > >$table= "CREATE TABLE pet (name VARCHAR(20), owner VARCHAR(20), species >VARCHAR(20), sex CHAR(1), birth DATE, death DATE)"; >?> >Thanks in advance for any help. > >Regards >Jan > > > >-- >PHP Database Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] How to create table?
Your code is good but your forget something simple, look your code after Edit mysql_query -- Send a MySQL query MERSAL --- Jan Grafstrom <[EMAIL PROTECTED]> wrote: > Hi! > I have just started to learn about mysql and wonder if my code is good? > $connexion = mysql_connect("localhost","login","passwd") or die ("ERROR > de connexion on Server"); > print ("Connection ok"); > mysql_select_db("database_name",$connexion) or die ("Cant find db"); > > $table= "CREATE TABLE pet (name VARCHAR(20), owner VARCHAR(20), species > VARCHAR(20), sex CHAR(1), birth DATE, death DATE)"; > ?> > Thanks in advance for any help. > > Regards > Jan > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]