如果用户填写表格并插入 1 或更高版本,则一些表字段是 int(11) 可以正常工作,但是当他们插入零时,我遇到了很大的麻烦并且它不起作用。我如何获得以下脚本以将 0 作为 int 插入
<?php
class add_qual {
private $db;
public function __construct(){
$this->db = new connection();
$this->db = $this->db->dbconnect();
}
public function new_qual($user_id,
$providers,
$code,
$title,
$title_under,
$full_title,
$description,
$comments,
$level,
$expires,
$period_months
$is_superceded) {
$flag='';
if($user_id==''){$flag='error'; }
if($providers==''){$flag='error'; }
if($title==''){$flag='error'; }
if($expires==''){$flag='error'; }
{$flag='error'; }
if ($flag=='') {
//if($user_id!=''){
$st = $this->db->prepare("INSERT INTO national_body_qualifications_list
(user_id,
providers,
code,
title,
title_under,
full_title,
description,
comments,
level,
expires,
period_months,
is_superceded )
VALUES (?,?,?,?,?,?,?,?,?,?)");
$st->bindParam(1, $user_id);
$st->bindParam(2, $providers);
$st->bindParam(3, $code);
$st->bindParam(4, $title);
$st->bindParam(5, $title_under);
$st->bindParam(6, $full_title);
$st->bindParam(7, $description);
$st->bindParam(8, $comments);
$st->bindParam(9, $level);
$st->bindParam(10, $expires);
$st->bindParam(11, $period_months);
$st->bindParam(12, $is_superceded);
$st->execute();
echo 'Yay it worked';
} else {
echo 'Max Fail';
}
}
}
?>