Re: Buscando una funcion...
| From: | Luis R | Date: | Tue, 28 Dec 2004 21:56:22 +0000 |
| Subject: | Re: Buscando una funcion... | ||
| References: | 1 2 3 | Groups: | php.general.es |
| Request: | Send a blank email to general-es+get-52892@lists.php.net to get a copy of this message | ||
Este comentario del manual me parece que te servira:
Here's a quick and dirty function that *should* return the number of
rows in a query even if the driver is being ornery.
<?php
function better_odbc_num_rows($con,$sql){
$result = odbc_exec($con,$sql);
$count=0;
while($temp = odbc_fetch_into($result, &$counter)){
$count++;
}
return $count;
}
?>
$con is your ODBC connection, and $sql is your SQL query. Put it in
your header and you should be good to go.
Yo tuve el mismo "problema" con las funciones nativas de oracle y ahi
no hay manera de evitar un doble recorrido, a menos que hagas una vez
el recorrido (con while, for, etc) y de paso cuentes las filas y metas
todos los datos en un arreglo, para que cuando los uses los saques del
areglo y no debas realizar otra consulta.
Saludos,
Luis rodríguez