Re: [PHP] if(), else() problem!

2006-10-09 Thread Rahul S. Johari
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

[PHP] if(), else() problem!

2006-10-06 Thread Rahul S. Johari
Ave, code: $db = dbase_open(osm.dbf, 0); if ($db) { $record_numbers = dbase_numrecords($db); for ($i = 1; $i = $record_numbers; $i++) { $row = dbase_get_record_with_names($db, $i); if ($row['PHONE'] == $thekey) { echo ³found²; } else { echo ³not found²; } }

Re: [PHP] if(), else() problem!

2006-10-06 Thread Jo�o C�ndido de Souza Neto
Usen this: echo ³not found²; break; Rahul S. Johari [EMAIL PROTECTED] escreveu na mensagem news:[EMAIL PROTECTED] Ave, code: $db = dbase_open(osm.dbf, 0); if ($db) { $record_numbers = dbase_numrecords($db); for ($i = 1; $i = $record_numbers; $i++) { $row =

Re: [PHP] if(), else() problem!

2006-10-06 Thread Jochem Maas
Rahul S. Johari wrote: Ave, code: $db = dbase_open(osm.dbf, 0); if ($db) { $record_numbers = dbase_numrecords($db); for ($i = 1; $i = $record_numbers; $i++) { $row = dbase_get_record_with_names($db, $i); if ($row['PHONE'] == $thekey) { echo ³found²; }

Re: [PHP] if(), else() problem!

2006-10-06 Thread Rahul S. Johari
Just tried, isn't working! It's doing the same thing that exit; does. Both else { echo Not Found; break; } And else { echo Not Found; exit; } Do the exact same thing. It will print not found (because it checks the first row, and if the

Re: [PHP] if(), else() problem!

2006-10-06 Thread Rahul S. Johari
Works like a charm!! I was trying something out with having a variable go completely out of the functions loops and print the not found message, but I wasn't hitting it. You did! // ^^^--- now tested ;) On 10/6/06 1:52 PM, Jochem Maas [EMAIL PROTECTED] wrote: $msg = 'cannot open database!';

Re: [PHP] if(), else() problem!

2006-10-06 Thread Børge Holen
Why not check if $thekey is in the $db, then else echo not found? seems all to much to do so little. On Friday 06 October 2006 18:35, Rahul S. Johari wrote: Ave, code: $db = dbase_open(osm.dbf, 0); if ($db) { $record_numbers = dbase_numrecords($db); for ($i = 1; $i = $record_numbers;

Re: [PHP] if(), else() problem!

2006-10-06 Thread Rahul S. Johari
Well, the actual script doesn't just print found number if the number exists... It displays all the data from the database of that record, also gives an interactive form to update the data and more. On 10/6/06 3:25 PM, Børge Holen [EMAIL PROTECTED] wrote: Why not check if $thekey is in the

Re: [PHP] if(), else() problem!

2006-10-06 Thread Børge Holen
On Friday 06 October 2006 21:45, Rahul S. Johari wrote: Well, the actual script doesn't just print found number if the number exists... It displays all the data from the database of that record, also gives an interactive form to update the data and more. Yes, and my point is still valid. need

Re: [PHP] if(), else() problem!

2006-10-06 Thread Rahul S. Johari
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... On 10/6/06 3:47 PM, Børge Holen

Re: [PHP] if(), else() problem!

2006-10-06 Thread Richard Lynch
On Fri, October 6, 2006 11:35 am, Rahul S. Johari wrote: $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) {

Re: [PHP] if(), else() problem!

2006-10-06 Thread Richard Lynch
On Fri, October 6, 2006 2:45 pm, Rahul S. Johari wrote: Well, the actual script doesn't just print found number if the number exists... It displays all the data from the database of that record, also gives an interactive form to update the data and more. None of which is a Good Reason to

Re: [PHP] if(), else() problem!

2006-10-06 Thread Richard Lynch
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

Re: [PHP] if(), else() problem!

2006-10-06 Thread Børge Holen
On Friday 06 October 2006 21:59, 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