Link to home
Start Free TrialLog in
Avatar of gpinzino
gpinzino

asked on

PHP Looped Function Will Not Send Multiple Emails

I am working on an osCommerce site which offers a few products and a variety of music classes. Each product and class is processed in the usual way, but an additional process is added which is supposed to send a separate email for each item or class purchased. The emails contain details about the product or the class. The function, doemail(), is attached. The problem is that when a user orders multiple items, only the email for the first item ordered is sent. The other items appear to be ignored.

The function first searches the database for the items contained in the order. It then enters a while loop. Inside the loop, a switch statement assigns values for various parameters associated with the item referenced in the row being examined. Next, a series of conditional routines, compose the message to be sent in the email. Finally, the email is supposed to be sent and the loop begins again with the next row.

As noted, the function works well for the first row, but fails to function after that. No error messages are generated on-screen.
customfunctions.php
ASKER CERTIFIED SOLUTION
Avatar of gr8gonzo
gr8gonzo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gpinzino
gpinzino

ASKER

You guys are good. I did not write this code, and I was going up a blind alley trying to debug it. I have now made the SQL change and moved it out of the loop and it works great now. Thank you both for your help.
You are welcome.