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 love to know about it...
Dunno but this:
... for ($i = 1; $i <= $record_numbers; $i++) { $row =
dbase_get_record_with_names($db, $i);
if ($row['PHONE'] ...
looks like my c++ source of kde, quite heavy. Yes I'm sure a lot of ppl on
this list like it like that, but from what I've learned is that projects
needs modifications from time to time. and a lot of jibberish like this
probably would have caused me a great deal of stress under a time table.
I would go on a problem like this with this solution
select whatever_tables_needed from $db where info=$hastomatch
whilethis and that {
show it all in a fancy form;
}else{
do_woop_that_thing and show something else;
}
That would only leave me with the $thekey info.
OR, reflecting on yer problem; would there be a possability that $thekey is
not at all valid?
Whereas you would need to add an error if the select renders no hit
>
> On 10/6/06 3:47 PM, "Børge Holen" <[EMAIL PROTECTED]> wrote:
> > 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 only to fetch bits'n bytes where
> > $thekey is located, leave the rest be.
> >
> >> On 10/6/06 3:25 PM, "Børge Holen" <[EMAIL PROTECTED]> wrote:
> >>> 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; $i++) {
> >>>> $row = dbase_get_record_with_names($db, $i);
> >>>> if ($row['PHONE'] == $thekey) {
> >>>> echo ³found²;
> >>>> }
> >>>> else {
> >>>> echo ³not found²;
> >>>> }
> >>>> }
> >>>> }
> >>>>
> >>>> The loop reads each row in the database, and checks whether it matches
> >>>> $thekey or not. If it does, it prints ³found², if it doesn¹t, it
> >>>> prints ³not found². But this happens for ³each row² in the database.
> >>>> So if there are 100 records, and the program does find a match, I¹ll
> >>>> get 99 ³not found² printed, and one ³found² printed.
> >>>>
> >>>> I can easily put an ³exit;² after my echo in the else(), but then it
> >>>> stops the loop, and doesn¹t go any further.
> >>>>
> >>>> What do I have to do to get results if the phone matches, print
> >>>> nothing for rows where it doesn¹t match, but give one single ³not
> >>>> found² if the phone number does not exist in the database?
> >>>>
> >>>> The logic is just failing me at this point.
> >>>>
> >>>> 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: [EMAIL PROTECTED]
> >>>> http://www.informed-sources.com
> >>
> >> 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: [EMAIL PROTECTED]
> >> http://www.informed-sources.com
>
> 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: [EMAIL PROTECTED]
> http://www.informed-sources.com
--
---
Børge
Kennel Arivene
http://www.arivene.net
---
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php