2017-01-16 3 views
0

Ich versuche, alle Städte des Landes zu bekommen, aber die coderigniter erzeugen falsch sql, Warum? Hier ist mein ModellCodeigner Wo falsche Abfrage erzeugen

private $cities = "cities"; 

public function get_cities_by_country($country_id){ 
    $this->db->select('id, city'); 
    $this->db->where('country_id', $country_id); 
    $this->db->from($this->cities); 
    return $this->db->get()->result_array(); 
} 

Und ich verwende eine log_message für $ country_id Und $ this-> db-> last_query()

INFO - 2017-01-16 18:30:25 --> '7' 
INFO - 2017-01-16 18:30:25 --> 'SELECT `id`, `city` 
FROM (`cities`) 
WHERE `country_id` = \'7\' 
AND `status` = 1' 

Ich denke, das ein probliem ist country_id = \ '7 \ ' Danke!

Antwort