我正在尝试创建并检查该帐户,但我有问题,即使我按下提交按钮,也要继续插入重复的ID,如何解决此问题,因为插入忽略仍然继续插入?
function exists_account($account)
{
$sql = "SELECT account FROM ".TB_PREF."account WHERE account=".db_escape($account) ."";
$result = db_query($sql, "Cannot retreive a account");
return (db_num_rows($result) > 0);
}
function add_update_account($account)
{
$date = date2sql($date_);
if (exists_gl_budget($account))
$sql = "INSERT INTO ".TB_PREF."account (
account) VALUES ('$date',
".db_escape($account).",'')";
else
$sql = "INSERT IGNORE INTO ".TB_PREF."account (
account, ) VALUES (
".db_escape($account).", '')";
db_query($sql, "The account could not be saved");
}