note 1614 modified in dbase_get_record by ronabop

From: Date: Sun, 05 Nov 2000 06:51:55 +0000
Subject: note 1614 modified in dbase_get_record by ronabop
Groups: php.notes 
Request: Send a blank email to php-notes+get-7403@lists.php.net to get a copy of this message
An example for you... My file $dbname="/tmp/test.php3" contains 3 fields: named "code", "f1",f2" My function is: if ( !$fp = dbase_open($dbname,0) ) { echo "Cannot open $dbname\n"; exit; } $nr = dbase_numrecords($fp); // Number of records. for ($i=1; $i <= $nr; $i++) { // From 1 to $nr as you know. $temp = dbase_get_record($fp,$i); if ( chop($temp[0]) == $key ) { // $key comes from FORM via WEB echo "$temp[0] : $temp[1] , $temp[2]<Br>"; dbase_close($fp); exit; } } It checkes that $key exists in field code of test.dbf, if so print. http://www.php.net/manual/function.dbase-get-record.php

« previous php.notes (#7403) next »