View Full Version : Linking to a foxpro database (using dbase)

05-07-2004, 08:29 PM
What am I doing wrong here? I've tried to make this work so many different ways! All I want to do is pull the second field information if the first field matches the selected statement. So far I've been successful in linking to the database, for

(where $nr=Number of records and $dbi=Database)

echo "<select>";
for ($i=1; $i <= $nr; $i++) {
$rec = dbase_get_record($dbi,$i);
echo "<option>",$rec[0]," --- ",$rec[1], " --- ", $i, "</option>";
echo "</select><br>";

works fine, but I can't get this:

for ($i=1; $i <= $nr; $i++) {
$rec = dbase_get_record($dbi,$i);
if($rec[0] == "WASSER"){
echo $rec[1];}

to work!

05-08-2004, 05:08 AM
Hi , dbf style databases are full of whitespace and tabs etc , but this is just a guess , try

if( trim( $rec[0] ) == "WASSER" ){