I am currently working on an application using php,mysql, and smarty templates. Two of the pages I am working on are doing very simple insert statements that look like this:
$comp_date = date("YmdHis");
$sql = "INSERT INTO comp (comp_date,firstname,lastname,vip_id,amount,pitboss_id,location_id) values ('".$comp_date."','".$firstname."','".$lastname."','".$vip_id."','".$POST["amount"]."','".$POST["pitboss_id"]."','".$_SESSION["location_id"]."')";
if ($conn->execute($sql))....
When the insert is done, it is inserting two records in the table for some unknown reason. A dump of the table looks like this:
CREATE TABLE comp (
comp_id int(11) NOT NULL auto_increment,
comp_date varchar(20) NOT NULL default '',
firstname varchar(50) NOT NULL default '',
lastname varchar(50) NOT NULL default '',
vip_id int(11) NOT NULL default '0',
amount float(4,2) NOT NULL default '0.00',
pitboss_id int(11) NOT NULL default '0',
location_id int(11) NOT NULL default '0',
KEY comp_id (comp_id)
) TYPE=MyISAM AUTO_INCREMENT=9 ;
Anyone have any idea of why it is inserting duplicate rows?