Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Want connect to dbase with php example code?

Status
Not open for further replies.

samansk

Technical User
Dec 7, 2000
44
I want some php example code for dbase_open( ), dbase_get_record( ), and related functions.

Thanks.
 
You can try the following sites for the correct syntax of the functions:


Here is some code on how to use dbase_get_record():
[tt]
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 &quot;$temp[0] : $temp[1] , $temp[2]<Br>&quot;;
dbase_close($fp);
exit;
}
}
[/tt]

I got that from the abovementioned site.

Hope this helps,

-Vic vic cherubini
malice365@hotmail.com
====
Knows: Perl, HTML, JavScript, C/C++, PHP, Flash, Director
====
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top