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

[eluser]mhel_dc[/eluser]
Hi guys,
Thanks for all your help... I manage to solve my problem with regards to this issue...

SPECS :

AS/400 IBM DB2 database
CodeIgniter 1.7.1
ODBC Driver provided by CodeIgniter

Facts :

1. We used ODBC driver provied by codeigniter to connect to db2 database.
2. num_rows() function is not supported in ODBC (allegedly, based on this exprience).

example:

function get_aecode($socode){

/*
I found no errors on this query.
Based on this query... it must return 1 valid row even if the result value
is less than,equal or greater than zero(0).
*/
$qry = "Select Count(MSOSAG) as rowCnt Where Warcod# ='".$socode ."'";
$dbresult = $this->db->query($qry);

/* this where I validate using num_rows function in order to
proceed to another process.
But I wonder why it keeps returning a -1 value.
*/

if($dbresult->num_rows() <= 0) {
$dboutput = '';
}
else {
$dboutput = 'This is a valid output'
}
}


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



Theme © iAndrew 2016 - Forum software by © MyBB