codeigniter database error in selecting data-Collection of common programming errors
crime_details.report_ID
holds a VARCHAR
, so your where condition should be
WHERE crime_details.report_ID = 'BA-12-00002'
i.e., you need to wrap the value in quotes.
Also, instead of using $this->db->query()
to run your hand-written MySQL query, you should use ActiveRecord’s query builder which would have taken care of this for you. For example, you could have done:
$query = $this->db->get_where('crime_reports', array( 'report_ID' => 'BA-12-00002' ));
Originally posted 2013-11-09 22:45:52.