RE: [PHP] while...

From: Date: Wed, 12 Jun 2002 20:46:22 +0000
Subject: RE: [PHP] while...
Groups: php.general 
Request: Send a blank email to php-general+get-101814@lists.php.net to get a copy of this message
Why not use while to loop through the shopping cart and add items to the message variable? $message = " Here is your order: "; while ($Row = mysql_fetch_array($Results)) $message .= "item description information"; $message .= " Thanks for your order... "; -----Original Message----- From: Phil Reid [mailto:phil@philip-reid.com] Sent: Wednesday, June 12, 2002 1:27 PM To: php-general@lists.php.net Subject: [PHP] while... I have a function in my script which sends an e-mail to my client company with details of a shopping cart order. I was wondering if it is possible to use a while loop inside the mail function so that I can send details of multiple items in one e-mail. Here is the code I am using. And bear in mind that I am a newbie to PHP, so if the mistake is obvious you will need to forgive me. $message = "-----------Client Information-----------\nUsername: $result[username]\nE-Mail Address: $result[email]\nContact Method: $contactoption\nForename: $result[forename]\nSurname: $result[surname]\nCompany: $result[company]\nHouse Number or Name: $result[address1]\nAddress Line 2: $result[address2]\nAddress line 3(optional): $result[address3]\nLocality: $result[local]\nCity: $result[city]\nPostcode: $result[postcode]\nHome Telephone: $result[homephone]\nWork Phone: $result[workphone]\nMobile Phone: $result[mobilephone]\nID: $result[id]\n----------Order Details----------while ($shoppingrow = mysql_fetch_array($shoppingresult))\nGrade: $shoppingrow[0]\nLength: $shoppingrow[1]"; $extra = "From: $result[forename]\r\nReply-To: $result[email]\r\n"; mail ("phil@philip-reid.com", "James Laird Website Order", $message); If anyone can be of assistance it would be very much appreciated. Regards, Phil Reid **************************************************************************** This message is intended for the sole use of the individual and entity to whom it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended addressee, nor authorized to receive for the intended addressee, you are hereby notified that you may not use, copy, disclose or distribute to anyone the message or any information contained in the message. If you have received this message in error, please immediately advise the sender by reply email and delete the message. Thank you very much.

« previous php.general (#101814) next »