Sometimes INSERT statement does not work and we do not get any error from MySQL.like
mysql_query(insert into abc(id_gen("abc"),$a,$b,$c))
id_gen("abc") is PK and is auto_inc, $a,$b and $c are strings.
when i print the values using print $qry; the values are correct but no insertion takes place in DB.
Can anyone help me?
Why sometimes Insert Does not work?
Moderator: General Moderators
if you are using PK with auto_increment pass NULL as the value. By doing this your are allowing your PK-auto_inc-column to assign a unique value. Otherwise, you might sometimes be trying to insert a duplicate PK value which isn't allowed.
Code: Select all
<?php
mysql_query("INSERT INTO abc VALUES (null, '$a','$b','$c')");
?>