发生数据库错误错误编号:1054 [英] A Database Error Occurred Error Number: 1054

查看:638
本文介绍了发生数据库错误错误编号:1054的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用sql删除我的配置项,但为什么它仍然出错?

i tried to make option delete for my CI with sql, but why its still error?

错误警告:

A Database Error Occurred

Error Number: 1054

Unknown column 'sip' in 'where clause'

select * from t_label where label = sip

Filename: E:\web\rbt.new\system\database\DB_driver.php

Line Number: 330



代码:

code:

function hapus($id_user){
            if($this->session->userdata('username')==TRUE) {
                $name = $this->db->query("select USER_NAME from t_user where USER_ID = $id_user")->row();
                $id_label = $this->db->query("select * from t_label where label = $name->USER_NAME")->row();
                $this->db->query("delete from t_label, t_publisher where t_label.id_label = t_publisher.id_label and t_label.id_label = $id_label->id_label");
                $this->db->delete('t_user', array('USER_ID' => $id_user));
                redirect("registrasi/reg");
            }
        }

我的代码有什么问题?真的需要帮助这里

whats wrong with my code? really need help here

推荐答案

您需要引用字符串。试试这个:

You need to quote the string. Try this:

$id_label = $this->db->query("select * from t_label where label = '" . $name->USER_NAME . "'")->row();

这篇关于发生数据库错误错误编号:1054的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆