我正在尝试使用此php文档来使用一种形式将信息输入数据库。我不断收到相同的错误,列“ custID”不能为null。我不知道怎么了或怎么做。我可能需要为此任务加上L,但是如果以后能遇到同样的问题,我能得到一个答案的话,这将是有帮助的。我已经尝试在mysql代码中执行NOT NULL AUTO_INCREMENT。我还尝试通过将NULL用于custID来做同样的事情。两者都不起作用。if(isset($_POST['submit'])){ $data_missing = array(); if(empty($_POST['custID'])){ $data_missing[] = 'Customer ID'; }else{ $custID = trim($_POST['custID']); } if(empty($_POST['custFirstName'])){ $data_missing[] = 'First Name'; }else{ $custFirstName = trim($_POST['custFirstName']); } if(empty($_POST['custLastName'])){ $data_missing[] = 'Last Name'; }else{ $custLastName = trim($_POST['custLastName']); } if(empty($_POST['address'])){ $data_missing[] = 'Address'; }else{ $address = trim($_POST['address']); } if(empty($_POST['city'])){ $data_missing[] = 'city'; }else{ $city = trim($_POST['city']); } if(empty($_POST['custstate'])){ $data_missing[] = 'State'; }else{ $custstate = trim($_POST['custstate']); } if(empty($_POST['custEmail'])){ $data_missing[] = 'Email'; }else{ $custEmail = trim($_POST['custEmail']); } if(empty($_POST['custPhone'])){ $data_missing[] = 'Phone'; }else{ $custPhone = trim($_POST['custPhone']); } if(empty($_POST['Password'])){ $data_missing[] = 'Password'; }else{ $Password = trim($_POST['Password']); } }
2 回答
慕村225694
TA贡献1880条经验 获得超4个赞
您必须删除,custID
因为AUTO_INCREMENT
$query = "INSERT INTO Customers (custFirstName, custLastName, address, city," . " custstate, custEmail, custPhone, Password) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
和这段代码
mysqli_stmt_bind_param($stmt, "sssssssss", $custFirstName,$custLastName, $address, $city, $custstate, $custEmail, $custPhone, $Password);
- 2 回答
- 0 关注
- 254 浏览
添加回答
举报
0/150
提交
取消