Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Oct 2003
    Thanked 0 Times in 0 Posts

    Linking to a foxpro database (using dbase)

    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!
    Help! I've reached the end of my code!

  • #2
    Super Moderator
    Join Date
    May 2002
    Perth Australia
    Thanked 101 Times in 99 Posts
    Hi , dbf style databases are full of whitespace and tabs etc , but this is just a guess , try

    PHP Code:
    if( trim$rec[0] ) == "WASSER" ){
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts