Q:

Codeigniter - SQL error. Driving me crazy

Here is my code:
$child = $this->getDetails($row['ParentOf_Id']);
which is in another function that calls a function called getdetails:
function getDetails($child_id=null,$limit=20){
    // select all the fields in the children table
    $this->db->select(castedColumns($this->children_table, $this->db));
    //where the id is the child id
    $q = $this->db->get_where($this->children_table, 'id='.$child_id);
    //store results array in details
    $details = $q->row_array();

I then get the following SQL error:
A Database Error Occurred
Error Number:
Incorrect syntax near '='.
SELECT CAST(AdditionalNotes AS TEXT) as AdditionalNotes, CAST(DisabilitiesNotes AS TEXT) as DisabilitiesNotes, DOB, msrepl_tran_version FROM Children WHERE id=
Id does not get appended? why?
Been driving me nuts because, when I do echo $child_id; I get the child Id before passing it into the SQL.

A:

try:
$this->db->select(castedColumns($this->children_table, $this->db));
$q = $this->db->get_where($this->children_table, array('id' => $child_id));
$details = $q->row_array();

