Mysql issue on form insert -


when insert thing in table via phpmyadmin have no problem, when try in form have created "admin-panel" in site message:

error: cannot add or update child row: foreign key constraint fails (`db467610239`.`articulo`, constraint `fk_articulo_genero` foreign key (`genero_id`) references `genero` (`id`) on delete no action on update no action) 

thing number insert new table exists in other table linked genre. don't know why happening, i'm using same insert in phpmyadmin php tweaks:

insert articulo values (id= null   , nombre='$nombre', imagen='$imagen', text='$text', precio='$precio', popup='$popup', genero_id ='$genero_id') 

your query should more this:

$query = " insert articulo (     nombre, imagen, text, precio, popup, genero_id ) values (     '$nombre', '$imagen', '$text', '$precio', '$popup', $genero_id )"; 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -