Date: 11/23/00
- Next message: David Vázquez: "[PHP-DB] Sql Server stored procedures"
- Previous message: Tom Lane: "[PHP-DB] Re: [GENERAL] Very queer errors with Postgres/PHP"
- In reply to: JJeffman: "Re: [PHP-DB] Automatic key"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
At 3:08 AM -0200 11/23/00, JJeffman wrote:
>I think the field type is "integer unsigned" , isn't it ?
>
>Jayme.
>
>http://www.conex.com.br/jjeffman
It doesn't *need* to be unsigned (though that's generally more useful
because it extends the range of your sequence). It should be one of
the integer types. MySQL won't prevent you from using a VARCHAR, but
the column will behave strangely after you insert a few values into
it, most likely.
>
>
>-----Mensagem Original-----
>De: Chris Aitken <chris <email protected>>
>Para: Webmaster <webmaster <email protected>>; <php-db <email protected>>
>Enviada em: quinta-feira, 23 de novembro de 2000 02:36
>Assunto: Re: [PHP-DB] Automatic key
>
>
>> At 11:25 PM 22/11/2000, you wrote:
>> >Hello everyone,
>> >
>> >Access has this nifty primary key that automatically increases itself
>> >when a new record is entered. Now I am working with MySQL and the
>> >documentation is kind of messy, does anybody knows if there is some kind
>> >of automatic key in MySQL? And if there isn't, could anyone suggest a
>> >piece of code to auto-generate a code that would make some sense?
>>
>>
>> When you create a table, you set the first field to be the following
>>
>> ALTER TABLE tname ADD fname VARCHAR(10) NOT NULL PRIMARY KEY
>AUTO_INCREMENT
>>
>> where tname is the name of your table, fname is the field you want to set
>> as the key. The rest basically tells it that the field cant be empty, is
>> the primary key and to increment the record automatically upon each new
>record.
>>
>>
>>
>> Hope this helps.
>>
>>
>>
>> Chris
>>
>>
>> --
>> Chris Aitken - Webmaster/Database Designer - IDEAL Internet
>> email: chris <email protected> phone: +61 2 4628 8888 fax: +61 2 4628 8890
>> --------------------------------------------
>>
>> Unix -- because a computer's a terrible thing to waste!
>>
>>
>> --
>> PHP Database Mailing List (http://www.php.net/)
>> To unsubscribe, e-mail: php-db-unsubscribe <email protected>
>> For additional commands, e-mail: php-db-help <email protected>
>> To contact the list administrators, e-mail: php-list-admin <email protected>
>>
>
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-db-unsubscribe <email protected>
>For additional commands, e-mail: php-db-help <email protected>
>To contact the list administrators, e-mail: php-list-admin <email protected>
-- Paul DuBois, paul <email protected>-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: David Vázquez: "[PHP-DB] Sql Server stored procedures"
- Previous message: Tom Lane: "[PHP-DB] Re: [GENERAL] Very queer errors with Postgres/PHP"
- In reply to: JJeffman: "Re: [PHP-DB] Automatic key"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

