I am creating a simple methode to get a field value from a row in a table. but somehow I could not get the field value ....
Here is my simple methode
private function getBankKode($transId=17000012720)
{
try
{
$qry = "SELECT * FROM accbank WHERE bank_transid='$transId'";
$res = $this->dbCon->query($qry);
$rec = $res->fetch(PDO::FETCH_ASSOC);
return $rec['bank_kode'];
}
catch(PDOException $e)
{
$this->set_commit("ROLLBACK");
$this->set_message("Methode getBankKode - ".$e->getMessage());
}
}
there is no error message come out ... the field bank_kode type is alphachar with 9 digit in lenght this methode should return value 'BANK-0014'.....
the funny thing is I could get other field value i.e the row ID if I change the field the return statament become return $rec[bank_id]
UPDATE: If I query the row table outside the class ...
$qry = "SELECT * FROM accbank WHERE bank_transid='17000012720'";
$res = $pdoCon->query($qry);
$rec = $res->fetch(PDO::FETCH_ASSOC);
$bankKode = $rec['bank_kode'];
I can get the bank_kode
field value .....