Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php CodeIgniter:DB Insert返回“1”,但表中未显示任何内容_Php_Mysql_Codeigniter - Fatal编程技术网

Php CodeIgniter:DB Insert返回“1”,但表中未显示任何内容

Php CodeIgniter:DB Insert返回“1”,但表中未显示任何内容,php,mysql,codeigniter,Php,Mysql,Codeigniter,我有一个网站,我一直在工作。在我重新安装操作系统之前,一切都很顺利。现在,在重新安装所有内容之后,该站点确实可以运行PHP works、phpinfo提供所有需要的组件等,但数据库查询不起作用 例如,当我尝试向数据库添加新用户时,我会执行以下操作: $new_user_insert_data = array( 'first_name' => $this->input->post('first_name'), 'last_name' => $this->

我有一个网站,我一直在工作。在我重新安装操作系统之前,一切都很顺利。现在,在重新安装所有内容之后,该站点确实可以运行PHP works、phpinfo提供所有需要的组件等,但数据库查询不起作用

例如,当我尝试向数据库添加新用户时,我会执行以下操作:

$new_user_insert_data = array(
    'first_name' => $this->input->post('first_name'),
    'last_name' => $this->input->post('last_name'),
    'email' => $this->input->post('email_address'),
    'username' => $this->input->post('username'),
    'password' => $this->input->post('password')
);

$insert = $this->db->insert('users', $new_user_insert_data);
这在重新安装操作系统之前起作用$执行insert调用后,insert为“1”,但数据库中没有显示任何内容。此外,使用get无法从数据库中检索任何内容。我试过mysql和mysqli,但都不管用。这里的原因是什么?我还原了在重新安装操作系统之前使用的同一数据库,但由于某些原因,“用户”表没有正确导入,因此我必须手动重新创建它。

$insert将始终显示1

请回显$this->db->受影响的\u行

运行这些查询

Ref:http://dev.mysql.com/doc/refman/5.0/en/show-grants.html

确保您正在检查同一个用户数据库表。您是否尝试检查错误-$this->db->\u error\u message?@Kami它导致这样的情况:mysql\u error期望参数1是resource,boolean given简单写入$this->db->insert'users',$new\u user\u insert\u data;不要把它分配给variable@plainjane没用。
Ref:http://dev.mysql.com/doc/refman/5.0/en/show-grants.html