[eluser]duartix[/eluser]
First thing: You need to replace the word
appointment by
query or no one that doesn't know Portuguese will understand what you need. I mean, it took me quite a while to figure you meant "consulta".
[quote author="gmferreir" date="1383477357"]hello my friends, [/quote]
Code:
$data = $this->input->post('address');
$da = $this->data_base_model->saddress($data);
You haven't loaded your model. You'll need to do it before you execute the function saddress:
Code:
$this->load->model('data_base_model');
[quote author="gmferreir" date="1383477357"]
return of this query have to query tree tables.
[/quote]
If the query spans 3 tables I believe you'll have to write it manually in the model, something like this:
Code:
public function saddress($data) {
try {
if (!is_null($data)) {
// Do the query
$query =
"SELECT *
FROM a, b, c
WHERE a.address LIKE '%" . $data . "%' and
a.id1=b.id1 AND
b.id2=c.id2";
$result = $this->db->query($query);
if (!empty($result) and $result->num_rows>0)
return $result->result_array();
}
return NULL;
} catch (Exception $ex) {
// Log de eventuais erros
error_log("Erro em saddress, $data= " . $data . ") \n" . $ex->getMessage());
return NULL;
}
}
I gave you a bonus: exception handling!