【发布时间】:2015-11-02 07:35:34
【问题描述】:
我正在开发一个工资系统。 The admin is able to successfully save these data but when an employee ID, which is already in the database, is selected, it is not added to the database.这是我的代码:
$sql = "INSERT INTO payroll VALUES('$id','$period','$paidDays','$hourlyRate','$hoursworked','$overtime','$overtimePay','$undertime','undertimePay','$sss','$philHealth','$pagibig','$OtherDeductions','$tax','$grossPay','$netPay')";
我需要解决这个问题才能记录员工的薪资历史。
请注意此代码有效。只是当输入了类似的员工时,并没有添加到数据库中。谢谢!
已编辑:这是table structure
【问题讨论】:
-
您希望将其添加到数据库中吗?还是您打算避免这种情况?
-
@Sina,我相信她想添加到数据库,因为他想拥有“工资历史”。您是否有机会将该列设为“唯一索引”?
-
你好新浪!是的,它应该被添加到数据库中。
-
嗨 Mustafa,我没有让它独一无二
-
你能把你的表结构贴出来