You are here: Re: [PHP] I'm having a blond moment with a while loop??? « PHP « IT news, forums, messages
Re: [PHP] I'm having a blond moment with a while loop???

Posted by Disguised Jedi on 10/21/46 11:15

On 5/8/05, George Pitcher <george.pitcher@ingenta.com> wrote:
> Hi guys,
>
> I'm doing something dumb but I can't see it.
>
> The basic premise is:
>
> sql search of orders sorted by customer
> set g_customer_id to ''
> loop through resultset
> if customer_id not same as last record's customer_id (g_customer_id)
> get customer email details
> set up message header if this is the first record for a customer
> set item details
> else
> set item details
> set g_customer_id to customer_id
> endif
> send email
> end loop
This looks fine to me. Although you might want to use an $i that gets
incremented instead of the customer IDs.

> The problem is that as a sample I have two records from one demo customer
> (me) and I can only get my email to handle one record - either sending
> separate records for each record or one email covering the last record only
Not sure I understand what is going on......Could you post the code?
It's kind of hard to troubleshoot code I can't see.

However, I can offer this suggestion. Check your syntax. Make sure
your loops have double equal signs, and be sure that the while loop
has a way of moving on in the records. (I didn't see anything like
that in the outline)

Also, you might want to try adding some echo statements in at the
various steps that output what is going to happen on the next line of
code. That way you can see what it's doing, and how many times it's
doing it. Even output the data in the table with a print_r to make
sure the data PHP has is the data you want it to loop through. Adding
output to troubleshoot your code is always a good thing to do.

Take two of these and call me in the morning. That is, try this
stuff, and if you can fix it, great. If not, reply WITH CODE POSTED
and I'll be happy to tell you what I can, and I'm sure others will be
too.

--
disguised.jedi@gmail.com

PHP rocks!
"Knowledge is Power. Power Corrupts. Go to school, become evil"

Disclaimer: Any disclaimer attached to this message may be ignored.
However, I must say that the ENTIRE contents of this message are
subject to other's criticism, corrections, and speculations.

This message is Certified Virus Free

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация