Re: MYSQL PROBLEM

From: Date: Tue, 26 Sep 2000 02:36:00 +0000
Subject: Re: MYSQL PROBLEM
Groups: php.general 
Request: Send a blank email to php-general+get-17471@lists.php.net to get a copy of this message
Addressed to: Dhaval Desai <dhaval_adams@yahoo.com> php-general@lists.php.net ** Reply to note from Dhaval Desai <dhaval_adams@yahoo.com> Fri, 22 Sep 2000 01:13:52 -0700 (PDT) > > Hi! Guys > > I have some problem creating a table in mysql. I am trying to make a table > as below: > > create table clickcount (id INT AUTO_INCREMENT NOT NULL PRIMARY_KEY, > clicks INT); > > > can anybody tell me what is the error..? WHat is the use of primary key > and Auto increment...?? try this... CREATE TABLE clickcount( id INT NOT NULL AUTO_INCREMENT, clicks INT PRIMARY KEY( id )); PRIMARY KEY names a field in the table as a unique index on the table, which is usually the key chosen to access the table. AUTO_INCREMENT causes the value of the field in a newly INSERTed record to be one higher than the current highest value for that field. It is very easy to create a unique identifier for each record that way. Note: when you insert into a table with an AUTO_INCREMENT field, you don't want to set that field. The database will do it for you. Rick Widmer Internet Marketing Specialists www.developersdesk.com

« previous php.general (#17471) next »