[eluser]mhel_dc[/eluser]
Hi,
Thanks for the suggestion but I already tried that by doing this:
function retrieve_aecode($socode)
{
$qry = “Select MSOSAG from itlib.WARFILE00 where WARCOD# =’”.$socode.”’”;
$dbresult = $this->db->query($qry);
echo $dbresult->num_rows();
if($dbresult->num_rows() <= 0){
$dboutput = ‘’;
}
else{
foreach($dbresult->result() as $row)
{
$dboutput = $row->MSOSAG;
}
}
return $dboutput;
}
but still, I manage to get a -1 result, I tried to revise the query and hopefully solve the problem..
function retrieve_aecode($socode)
{
$qry = “Select Count(MSOSAG) as fldCount from itlib.WARFILE00 where WARCOD# =’”.$socode.”’”;
$dbresult = $this->db->query($qry);
echo $dbresult->num_rows();
if($dbresult->num_rows() <= 0){
$dboutput = ‘’;
}
else{
foreach($dbresult->result() as $row)
{
$dboutput = $row->fldCount;
}
}
return $dboutput;
Amazingly it produced an error stating that $dboutput is not likely registered as
a variable or $dboutput has never been declared.
for me to check whether I'm really not getting any row results I executed the
same query (the 2nd code) using SQL Developer, luckily, I manage to get 1 row
with 0 value.... how come that num_rows() function cannot see or determine that
the query returned a row with 0 as a result of the query?