Re: help with dbase!!!
| From: | Lucas Chan | Date: | Sat, 27 Oct 2001 09:30:29 +0000 |
| Subject: | Re: help with dbase!!! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-72548@lists.php.net to get a copy of this message | ||
I don't really know anything about dbase. But don't you need to tell it
which tables and fields you wish to retrieve?
Regards,
[ lucas ]
"Alejandro Viana" <aviana@wanadoo.es> wrote in message
news:001e01c15ec9$d3d566a0$9db2243e@miordenador...
I'm trying to read a record from a dbase data base so I've previously
opened it successfully. The problem is that I call the function
dbase_get_record, but it returns no records. The database is ok because I
call the funcion dbase_numfields and dbase_numrecords and they give me
correct information. Would you help me, please?. Here is the source code
that fails.
aviana@wanadoo.es
Estoy intentando leer un registro de una base de datos dbase, por lo que
antes la he abierto con éxito. el problema residen en que llamo a la función
dbase_get_record, pero no me devuelve ningún registro. La base de datos está
bien, porque llamo a la función dbase_numfields y dbase_numrecords y me dan
información correcta. ¿Me podríais ayudar, por favor?. Ahí va el código
fuente:
aviana@wanadoo.es
Source code- Código fuente:
<?
$based="articulo.dbf";
if (($descriptor=dbase_open ($based, 0))==0){
printf ("<br>Error al abrir la base de datos");
}else{
printf ("<br>Base de datos abierta");
$num_registros=dbase_numrecords($descriptor);
$num_campos=dbase_numfields($descriptor);
for ($i=1;$i<=$num_registros;$i++){
$registro= dbase_get_record ($descriptor, $i);
for ($j=0;$j<$num_campos;$j++){
printf ("<br>Fila %d,Campo %d vale %S", $i, $j, $registro[$j]);
}
}
dbase_close($descriptor);
printf ("<br>Base de datos cerrada");
}
?>