Re: [PHP] auto-increment not working?? MySQL

2004-07-12 Thread Curt Zirzow
* Thus wrote Jay Blanchard:
> [snip]
> i've got a strange problem with a MySQL table. although my 'id' column
> is set to 'auto_increment', each new record i insert has the value 1.
> (instead of 1, 2, 3, etc.)
> 
> i checked my sql statement and i'm not assigning the id value by
> mistake. here is my create statement (showing only a few columns from
> the table for brevity):
> 
> CREATE TABLE `customers` (
>   `id` int(10) unsigned NOT NULL auto_increment,
>   `fname` varchar(20) NOT NULL default '',
>   `lname` varchar(20) NOT NULL default '',
>   `is_active` tinyint(4) NOT NULL default '0',
>   PRIMARY KEY  (`fname`,`lname`,`email`,`id`),
>   UNIQUE KEY `email` (`email`)
> ) TYPE=MyISAM;
> 
> 
> anyone know what's going on??
> [/snip]
> 
> The guys on the MySQL list do. Have you read this-->
> http://dev.mysql.com/doc/mysql/en/example-AUTO_INCREMENT.html

more like 'db 101' and 'Intro to Mailing lists', would be a more
appropriate thing to do.



Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] auto-increment not working?? MySQL

2004-07-12 Thread barophobia
On Mon, 12 Jul 2004 15:36:20 -0500, Jay Blanchard
<[EMAIL PROTECTED]> wrote:

> The guys on the MySQL list do. Have you read this-->
> http://dev.mysql.com/doc/mysql/en/example-AUTO_INCREMENT.html

not for this issue no.

the problem for those that read this later is not that i am using
multiple primary keys but rather the order in which they are defined.
'id' should be first in the list. once i moved 'id' to the first spot
the table began incrementing as per expected behavior.

thanks jay.


chris.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] auto-increment not working?? MySQL

2004-07-12 Thread Justin Patrin
Your primary key should be only (`id`).

On Mon, 12 Jul 2004 13:04:19 -0700, barophobia <[EMAIL PROTECTED]> wrote:
> hello.
> 
> i've got a strange problem with a MySQL table. although my 'id' column
> is set to 'auto_increment', each new record i insert has the value 1.
> (instead of 1, 2, 3, etc.)
> 
> i checked my sql statement and i'm not assigning the id value by
> mistake. here is my create statement (showing only a few columns from
> the table for brevity):
> 
> CREATE TABLE `customers` (
>   `id` int(10) unsigned NOT NULL auto_increment,
>   `fname` varchar(20) NOT NULL default '',
>   `lname` varchar(20) NOT NULL default '',
>   `is_active` tinyint(4) NOT NULL default '0',
>   PRIMARY KEY  (`fname`,`lname`,`email`,`id`),
>   UNIQUE KEY `email` (`email`)
> ) TYPE=MyISAM;
> 
> anyone know what's going on??
> 
> chris.
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> !DSPAM:40f2f0f6322131004619089!
> 
> 


-- 
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] auto-increment not working?? MySQL

2004-07-12 Thread Jay Blanchard
[snip]
i've got a strange problem with a MySQL table. although my 'id' column
is set to 'auto_increment', each new record i insert has the value 1.
(instead of 1, 2, 3, etc.)

i checked my sql statement and i'm not assigning the id value by
mistake. here is my create statement (showing only a few columns from
the table for brevity):

CREATE TABLE `customers` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `fname` varchar(20) NOT NULL default '',
  `lname` varchar(20) NOT NULL default '',
  `is_active` tinyint(4) NOT NULL default '0',
  PRIMARY KEY  (`fname`,`lname`,`email`,`id`),
  UNIQUE KEY `email` (`email`)
) TYPE=MyISAM;


anyone know what's going on??
[/snip]

The guys on the MySQL list do. Have you read this-->
http://dev.mysql.com/doc/mysql/en/example-AUTO_INCREMENT.html

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php