insert into `patient` ( `pat_f_name`, `pat_l_name`, `pat_gender`, `pat_age`, `pat_dob`, `pat_blood_grp`, `pat_weight`, `pat_contact_no`, `pat_address` )
-> VALUES
-> ('$user_fname','$user_lname','$user_gender','$user_age','$user_dob','$user_bg','$user_weight','$user_contact_no','$user_address');
ERROR 1366(HY000):不正确的整数值:' $ user_age'对于专栏' pat_age'在第1行
表格看起来像
+----------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+-------------+------+-----+---------+----------------+
| pat_id | int(50) | NO | PRI | NULL | auto_increment |
| dr_id | int(50) | NO | | NULL | |
| pat_f_name | char(20) | NO | | NULL | |
| pat_l_name | char(20) | NO | | NULL | |
| pat_gender | char(20) | NO | | NULL | |
| pat_age | int(20) | NO | | NULL | |
| pat_dob | date | NO | | NULL | |
| pat_blood_grp | varchar(10) | NO | | NULL | |
| pat_weight | int(10) | NO | | NULL | |
| pat_contact_no | varchar(12) | NO | | NULL | |
| pat_address | varchar(20) | NO | | NULL | |
+----------------+-------------+------+-----+---------+----------------+
答案 0 :(得分:0)
$sql = "INSERT INTO patient(pat_f_name, pat_l_name, pat_gender, pat_age, pat_dob, pat_blood_grp, pat_weight, pat_contact_no, pat_address) VALUES ('$user_fname','$user_lname','$user_gender','$user_age','$user_dob','$user_bg','$user_weight','$user_contact_no','$user_address')";