我仍然不知道为什么它会跳过“成功”和“重复 ID”的消息框,尽管数据成功插入数据库...有人可以帮我吗,因为我还是这个 php 和 mysql 的新手
$insertSQL = sprintf("INSERT INTO kontrak (ID, NAME, BIRTH, COUNTRY) VALUES (%s,(UPPER('%s')), %s, %s)",
GetSQLValueString($_POST['Id'], "int"),
strtoupper(GetSQLValueString($_POST['Nama'], "text")),
GetSQLValueString($_POST['Birth'], "date"),
GetSQLValueString($_POST['Country'], "text"));
mysql_select_db($db_doctor, $doctor);
$Result1 = mysql_query($insertSQL, $doctor) or die(mysql_error());
if($insertGoTo)
{
echo "<script>alert('succes');document.location.href = 'staff.php';</script>";
}
else
{
echo "<script>alert('duplicate id.');document.location.href = 'serch.staf.php
';</script>";}
$insertGoTo = "add_info.php";
if (isset($_SERVER['QUERY_STRING']))
{
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}