致命错误:未捕获的异常“异常”有消息“1048

问题描述:

所以我想在我的数据库中插入一个新的用户,但是当我要发布我的注册,这个错误弹出:致命错误:未捕获的异常“异常”有消息“1048

Fatal error: Uncaught exception 'Exception' with message '1048' in 
C:\xampp\htdocs\Zephryte\app\classes\users.class.php:110 Stack trace: #0 
C:\xampp\htdocs\Zephryte\index.php(5): users->register() #1 {main} thrown in 
C:\xampp\htdocs\Zephryte\app\classes\users.class.php on line 110 

我做知道这来自于我的MySQLi连接,但我不知道这意味着什么或做什么用的吧...

这是产生错误代码:

$query->bind_param('ssssssssssssssssssssss', $data, $_POST['username'], $_POST['password'], $een, $_POST['email'], $code, $ipAddress, $ipAddress, $data, $data, $een, $null, $null, $nul, $nul, $een, $een, $nul, $_POST['skype'], $nul, $nul, $null); //106 

$query->execute(); //107 

if (!$query->execute()) //108 

{ //109 

    throw new Exception($this->db->conn->errno, 1); //110 

} //111 

$query->close(); //112 

是否任何人你们知道错误是什么,并且h解决它呢?

谢谢。

+0

什么是'$ nul','$ null','$ een',以及其中的其他变量?这些*全部*设置正确吗? – 2014-10-30 20:31:34

+0

http://*.com/questions/22444873/php-mysql-execute-failed-1048-column-title-cannot-be-null-error http://*.com/questions/25154105/error-1048- 23000-column-can-be-null-however-i-am-inserting-valid-data – Cheery 2014-10-30 20:31:46

+0

根据文档:['1048:Column can not be null ...'](http://forums.mysql.com/ read.php?98,576167,576167)。其中一列显示为“NULL”。 – War10ck 2014-10-30 20:32:26

由于您错过了某一列,因此您的查询失败。

我不能说这是失踪,但

http://php.net/manual/en/mysqli.error.php

将给予更多的信息

MySQL的文档显示,该错误可能是空列。 http://www.mysqlfaqs.net/mysql-faqs/Errors/1048-Column-cannot-be-null

出现异常的数字是mysql errno,那是他的关键。所有你需要做的是谷歌mysql 1048找到mysql错误文档。