Tema: Referencias
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 30/11/2004, 16:29
Avatar de Fociños
Fociños
 
Fecha de Ingreso: marzo-2004
Ubicación: A Coruña
Mensajes: 587
Antigüedad: 22 años, 7 meses
Puntos: 0
Referencias

Hola, tengo el siguiente código pero me da error, estoy utilizando MySQL 4.0.x
Código PHP:
CREATE TABLE `anuncio` (
`
id_anuncio` int( 11 ) unsigned NOT NULL AUTO_INCREMENT ,
`
titular` varchar( 50 ) NOT NULL default '',
`
texto` text NOT NULL ,
`
fecha_hora_publ` datetime NOT NULL default '0000-00-00 00:00:00',
`
fecha_caduc` date NOT NULL default '0000-00-00',
`
localidad` varchar( 20 ) NOT NULL default '',
`
importe` decimal( 10, 2 ) NOT NULL default '0.00',
`
id_usuario` int( 11 ) unsigned NOT NULL default '0',
`
id_provincia` tinyint( 3 ) unsigned NOT NULL default '0',
`
id_tipo_anuncio` smallint( 5 ) unsigned NOT NULL default '0',
PRIMARY KEY ( `id_anuncio` ) ,
FOREIGN KEY `id_usuario` REFERENCES `usuario('id_usuario')` ON UPDATE CASCADE ON DELETE CASCADE ,
FOREIGN KEY `id_provincia` REFERENCES `provincia(id_provincia)` ON UPDATE CASCADE ON DELETE CASCADE ,
FOREIGN KEY `id_tipo_anuncio` REFERENCES `tipo_anuncio(id_tipo_anuncio)` ON UPDATE CASCADE ON DELETE CASCADE ,
UNIQUE KEY `titular texto id_usuario id_tipo_anuncio id_provincia` ( `titular` , `texto` ( 1 ) , `id_usuario` , `id_provincia` , `id_tipo_anuncio` )
) 
TYPE = MYISAM AUTO_INCREMENT =34 
ySQL ha dicho: Documentación
#1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'REFERENCES `usuario('id_usuario')`
ON UPDATE CASCADE

Gracias por vuestro tiempo