Number of rows in an Informix query?

wxdqz

New Member
I'm trying to get the _actual_ number of rows returned in a query and not getting it.

The number should be two, since I'm doing a wildcard select on a table that only has two rows.

ifx_num_rows reports 0, and ifx_affected_rows gives me 10.

here's a snippet I'm toying with:

$cn = ifx_connect($db, $uid, $pwd) or die("$svr won't talk to me!");

# perform the query and then get # of rows and columns returned.
$rp = ifx_prepare($SQL, $cn);
$rs = ifx_do($rp);
$nRows = ifx_num_rows($rp);
$nCols = ifx_num_fields($rp);
$types = ifx_fieldtypes ($rp);
if(! $rs) die ("<br>No data found!<br>\n");
echo "<b>Total of ".$nRows." rows and ".$nCols." columns returned.</b>\n";


This snippet was taken from a script written for MySQL, but modified to Informix routines. Just seems like the ifx_num_rows isn't working for me.

Any ideas?
 
Back
Top