Created
July 29, 2013 22:49
-
-
Save francisrod01/6108584 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Cep { | |
public function get_cep_cidade($tId, $city) | |
{ | |
$this->db->select('cep_cidade.nome, cep_estado.id, cep_estado.id_uf'); | |
$this->db->from('cep_cidade'); | |
$this->db->join( | |
'cep_estado', | |
'cep_cidade.id_uf = cep_estado.id_uf AND cep_cidade.nome = "'.$city.'"', | |
'left' | |
); | |
$this->db->where('cep_estado.id', $tId); | |
$query = $this->db->get(); | |
if ($query) | |
{ | |
return $query; | |
} | |
else | |
{ | |
return FALSE; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CI_DB_mysqli_result Object | |
( | |
[conn_id] => mysqli Object | |
( | |
[affected_rows] => 1 | |
[client_info] => 5.5.31 | |
[client_version] => 50531 | |
[connect_errno] => 0 | |
[connect_error] => | |
[errno] => 0 | |
[error] => | |
[field_count] => 3 | |
[host_info] => Localhost via UNIX socket | |
[info] => | |
[insert_id] => 0 | |
[server_info] => 5.5.32-0ubuntu0.12.04.1 | |
[server_version] => 50532 | |
[stat] => Uptime: 38533 Threads: 10 Questions: 5354 Slow queries: 0 Opens: 730 Flush tables: 1 Open tables: 176 Queries per second avg: 0.138 | |
[sqlstate] => 00000 | |
[protocol_version] => 10 | |
[thread_id] => 497 | |
[warning_count] => 0 | |
) | |
[result_id] => mysqli_result Object | |
( | |
[current_field] => 0 | |
[field_count] => 3 | |
[lengths] => | |
[num_rows] => 1 | |
[type] => 0 | |
) | |
[result_array] => Array | |
( | |
) | |
[result_object] => Array | |
( | |
) | |
[custom_result_object] => Array | |
( | |
) | |
[current_row] => 0 | |
[num_rows] => | |
[row_data] => | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$result = $this->Cep->get_cep_cidade($location['region'], $location['city']); | |
print_r($result); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment