Welcome Guest, Not a member yet? Register   Sign In
num_rows() always return a -1 value after query in db2 database
#1

[eluser]mhel_dc[/eluser]
I have this code just to check whether an entry is existing in my database,
However, the num_rows() function always returns a -1 value even if the data I queried
exists.
What would have caused this?
I did check if the database parameters in database.php file in codeigniter
I found no possible errors.


function retrieve_aecode($socode)
{
$qry = "Select MSOSAG from itlib.WARFILE00 where WARCOD# ='".$socode."'";
$dbresult = $this->db->query($qry);

if($dbresult->num_rows() <= 0){
$dboutput = '';
}
else{
foreach($dbresult->result() as $row)
{
$dboutput = $row->MSOSAG;
}
}
return $dboutput;
}

By the way... im using codeigniter 1.7.1 and im connecting in AS/400 database using odbc.
any help will do. Thanks in advance.


Messages In This Thread
num_rows() always return a -1 value after query in db2 database - by El Forum - 09-17-2009, 08:14 PM



Theme © iAndrew 2016 - Forum software by © MyBB