03-15-2011, 01:21 PM
[eluser]dallen33[/eluser]
I'm generating some JSON for an autocomplete form. I found this code online which works beautifully, but whenever I try to re-factor it to CodeIgniter's active record style, it never works. Any ideas how I could do this?
For example, this doesn't work:
I'm generating some JSON for an autocomplete form. I found this code online which works beautifully, but whenever I try to re-factor it to CodeIgniter's active record style, it never works. Any ideas how I could do this?
Code:
$return_arr = array();
$query = mysql_query("SELECT * FROM clients");
while ($row = mysql_fetch_array($query, MYSQL_ASSOC)):
$row_array['value'] = $row['name'];
array_push($return_arr, $row_array);
endwhile;
For example, this doesn't work:
Code:
$query = $this->db->get('clients');