Php 如何解决未知where类错误1054(错误号为)

Php 如何解决未知where类错误1054(错误号为),php,mysql,codeigniter,Php,Mysql,Codeigniter,我正在codeigniter应用程序中实现选择查询 但它显示了以下错误 A Database Error Occurred Error Number: 1054 Unknown column 'Ak3456' in 'where clause' SELECT * FROM `table` WHERE `Ak3456` IS NULL Filename: C:/wamp/www/application/system/database/DB_driver.php Line Number: 6

我正在codeigniter应用程序中实现选择查询

但它显示了以下错误

A Database Error Occurred
Error Number: 1054

Unknown column 'Ak3456' in 'where clause'

SELECT * FROM `table` WHERE `Ak3456` IS NULL

Filename: C:/wamp/www/application/system/database/DB_driver.php

Line Number: 691
我的选择查询是

$data = $this->db->get_where('table',$number);

请任何人帮我解决这个问题。

在codeigniter中选择查询结构如下:

$this->db->get_where('table_name',['feild_name'=>'value'])

因此,您可以在数组类型中提供where数据

比如说,

$data=$this->db->get_-where('table',array('feild_-name'=>$number))

正确的语法是

// replace table with your table name and field_name with for which value  
//you want to search for Ak3456
$data = $this->db->get_where('table',['field_name' => 'Ak3456']); 

语法

get_where([$table = ''[, $where = NULL[, $limit = NULL[, $offset = NULL]]]])
参数

  • $table(mixed)–从中提取数据的表;字符串或数组
  • $where(字符串)–where子句
  • $limit(int)–限制条款
  • $offset(int)–offset子句
返回:CI_DB_结果实例(方法链接)

返回类型:CI_DB_结果

可能重复的