Auto increment (Newbie)

2002-05-29 Thread r

Hey there,
I know this might sound like a stupid question to a lot of you guys out
there but please keep in mind I come from an oracle background and am new to
this:

I am accessing MySql from PHP, I have two questions regarding Auto_Increment

1) how to create an auto_increment?

create table MyTestTable(cno int, name varchar(20));
works fine, but I want cno as an auto_increment, what statement to use?

2)to insert int  into my example I will use
insert into MyTestTable(555,'Ryan');
How would I do it if I was entering data and the cno was an auto increment?

I have glossed through the manual, but frankly after 6 hours of PHP
programming i'm feeling braindead so PLEASE dont ask me to RTFM, if you have
links to the specific topic in the manual no problem, just tired of
searching.

Cheers all,
-Ryan.



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Auto increment (Newbie)

2002-05-29 Thread Ray a PowerWeb Tech

manual_Reference.html#CREATE_TABLE
create_definition:
  col_name type [NOT NULL | NULL] [DEFAULT default_value] [AUTO_INCREMENT]
[PRIMARY KEY] [reference_definition]

create table MyTestTable(cno int AUTO_INCREMENT, name varchar(20));


can't seem to find the ref right now, but 
 insert into MyTestTable(555,'Ryan');
 insert into MyTestTable (name) values ('Ryan');
 or
 insert into MyTestTable values (null, 'Ryan');

On Thursday 30 May 2002 3:43, you wrote:
 Hey there,
 I know this might sound like a stupid question to a lot of you guys out
 there but please keep in mind I come from an oracle background and am new
 to this:

 I am accessing MySql from PHP, I have two questions regarding
 Auto_Increment

 1) how to create an auto_increment?

 create table MyTestTable(cno int, name varchar(20));
 works fine, but I want cno as an auto_increment, what statement to use?

 2)to insert int  into my example I will use
 insert into MyTestTable(555,'Ryan');
 How would I do it if I was entering data and the cno was an auto increment?

 I have glossed through the manual, but frankly after 6 hours of PHP
 programming i'm feeling braindead so PLEASE dont ask me to RTFM, if you
 have links to the specific topic in the manual no problem, just tired of
 searching.

 Cheers all,
 -Ryan.

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php