-1
Good, I need to search a database Sybase fields type Date to fill in my application.
When searching for the necessary information and debugging it, the fields in the Date format appeared to me empty instead of being filled with their respective value in the database.
I’m using ODBC to connect to the database.
Does anyone know why this is happening?
My model query is very simple:
public function recibo($codigo, $numero) {
require(APPPATH . 'libraries/odbc_conn.php');
$query = odbc_exec($db, "select * from GP_Web_Recibos where Codigo = 14 AND Numero = 3302");
while ($row = odbc_fetch_array($query)) {
$tudo[] = $row;
}
if (empty($tudo)) {
$tudo = 0;
}
return $tudo;
}
Controller :
public function teste2() {
$nrrecibo = $this->uri->segment(3);
$codigo = $this->session->codigo;
$campos = $this->Vencimentos_model->recibo($codigo, $nrrecibo);
$abono = [];
$descontos = [];
foreach ($campos as $key => $campo) {
if ($campo['Codigo_Paga_Desc'] == '1') {
$abono[] = $campo['Resultado'];
} elseif ($campo['Codigo_Paga_Desc'] == '2') {
$descontos[] = $campo['Resultado'];
}
# code...
}
$campos['abonototal'] = array_sum($abono);
$campos['descontostotal'] = array_sum($descontos) - $campos[0]['Vl_SSOC'] - $campos[0]['Vl_IRS'];
$data['campos'] = $campos;
echo "<pre>";
print_r($campos);
echo "</pre>";
}