Re: if(), else() problem!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Well actually, all 80 fields (not records) that I'm displaying out of the
row (matched by phone number) have to be displayed on the page.
Non-Editable. Just displayed for viewing.

I am certainly using the query to search dbase and display the results. So
technically nothing that I'm doing is causing any problems...

As for the if(), else()... I did figure out a couple of ways to do it... But
I guess the simplest one was the one you & jochem had suggested, which is
pretty much like...

$db = dbase_open("osm.dbf", 0);
if ($db) {
   $record_numbers = dbase_numrecords($db);
    $found = false;
    for ($i = 1; $i <= $record_numbers; $i++) {
   $row = dbase_get_record_with_names($db, $i);
   if ($row['PHONE'] == $thekey) {
   echo ³found²;
    $found = $thekey;
  }
   else {
//  >     echo ³not found²;
// do nothing here
     }
 }

if (!$found) echo "not found";
}

Basically used a 'flag'... If phone number was matched (found) in the
dbase... Everything gets displayed and nothing happens in the else() ... But
if phone number was not found, flag is raised, i.e., error message
displayed. 

Working like a charm as far as I can tell.

Thanks!

On 10/6/06 5:21 PM, "Richard Lynch" <ceo@xxxxxxxxx> wrote:

> On Fri, October 6, 2006 2:59 pm, Rahul S. Johari wrote:
>> I'm not sure if I understand your point then! I have about 80 fields
>> in that
>> database that are fetched and displayed on the page using this code.
>> If
>> there's a simpler way to do this, and have it work the if() else()
>> error as
>> well, I would love to know about it...
> 
> Are you displaying 79 records not editable, and ONE that is editable,
> all on one page?
> 
> That's an Okay Reason, but you'd probably have happier users if you
> didn't do that...
> 
> Give them a link to edit ONE record and let them edit that all by
> itself and then come back to the list when they are done.
> 
> "Too Much Information" is not a good thing.

Rahul S. Johari
Supervisor, Internet & Administration
Informed Marketing Services Inc.
500 Federal Street, Suite 201
Troy NY 12180

Tel: (518) 687-6700 x154
Fax: (518) 687-6799
Email: rahul@xxxxxxxxxxxxxxxxxxxx
http://www.informed-sources.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux