我在我的 html 中将 dob 设置为“日期”类型,在我的 stu 表中,我将其作为字符串,所以我将其设置为 varchar,但 null 被存储为默认值
检查代码...
/* Prepared statement, stage 1: prepare */
if (!($stmt = $mysqli->prepare("INSERT INTO `stu` (`name`, `gender` , `dob`) VALUES (
?, ?, ? ) "))) {
echo "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
}
/* Prepared statement, stage 2: bind and execute */
if (!$stmt->bind_param('sss', $name , $gender , $dob )) {
echo "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error;
}