hi everyone,
i keep on getting this error when i try to insert a value into a table via php.
Duplicate entry '' for key 2
i've tried a lot of solutions from the web including changing the the primary key from int to bigint. i also flushed the database and deleted all entries from the database but i still got that error. i could insert records from the nysql command prompt but not from the php script.
does anyone know what might be wrong?
the table in question looks like this:
CREATE TABLE `article_fields` (
`id` int(11) NOT NULL auto_increment,
`field_title` varchar(75) NOT NULL,
`field_type` varchar(75) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
and my php code to insert data into the table looks like this:
$sql = 'INSERT INTO article_fields VALUES("NULL","'.$new_text.'","'.$field_type.'")';
$insert = mysql_query($sql) or die(mysql_error());