Re: Auto increment en MySQL
| From: | Patxi Echarte | Date: | Mon, 16 Jul 2001 14:23:59 +0000 |
| Subject: | Re: Auto increment en MySQL | ||
| References: | 1 | Groups: | php.general.es |
| Request: | Send a blank email to general-es+get-12292@lists.php.net to get a copy of this message | ||
Hola,
El problema es que no has definido el campo id como clave principal de la tabla. Debe quedar como
sigue:
CREATE TABLE TABLA (id INT NOT NULL AUTO_INCREMENT, fecha CHAR (10), titulo CHAR (255), texto TEXT,
PRIMARY KEY(id) )
Saludos
On Mon, 16 Jul 2001 14:20:29 +0200
"xavi" <berna@farmavet.com> wrote:
> Quiero crear una tabla desde PHP y que el campo ID sea autoincrementable,
> he mirado como lo hace el MySQL y lo hace así:
>
> CREATE TABLE TABLA (id INT NOT NULL AUTO_INCREMENT, fecha CHAR (10), titulo
> CHAR (255), texto TEXT )
>
> Peró si lo pongo así en PHP no funciona, si quito el AUTO_INCREMENT si que
> me crea al Tabla.
>
> ¿Cuál puede ser el error?
>
>
> ---------------------------------------------------------------------
> Archivo On-line: http://www.phpes.com/
> Manual PHP en español: http://www.php.net/manual/es/
> Para dar de baja la suscripción, mande un mensaje a:
> lista-unsubscribe@phpes.com
>
--
[Patxi Echarte Ayerra]
patxi@nmp.es
NMP-New Media Publishing
Tel. 948 197 983
http://www.nmp.es
--------------------------