Re: [SPAM] informix+php -> row count
Posted in 2005
Hi, Acoording to the php mnual function ifx_affected_rows ... <quote http://www.php.net/manual/en/function.ifx-affected-rows.php> For inserts, updates and deletes the number is the real number (sqlerrd[2]) of affected rows. For selects it is an estimate (sqlerrd[0]). Don't rely on it. The database server can never return the actual number of rows that will be returned by a SELECT because it has not even begun fetching them at this stage (just after the "PREPARE" when the optimizer has determined the query plan). </quote> And ifx_rows_count ... is for the already fetched rows. <quote http://www.php.net/manual/en/function.ifx-num-rows.php> Description int ifx_num_rows ( int result_id ) Gives the number of rows fetched so far for a query with result_id after a ifx_query() or ifx_do() query. </quote> So you can't, BUT if you use ADODB (http://adodb.sf.net) as the abstraction layer, you can use a common method across all the supported databases (http://phplens.com/lens/adodb/docs-adodb.htm#po_recordcount). This is simulated in the non capable databases swith a select count(*)... HTH tomek escribi': > Hi, > I have a select... and how can I count rows returned by it before fetching > them? > Ifx_affected_rows returns 1, ifx_rows_count return 0. > Is there is something like in postgres -> pg_num_rows? > > > > __ > Best Regards, > Tom > > > > sending to informix-list