Just some advice, the way I do emails is to split up the lines on separate lines. Kinda makes sense, eh?
Code: Select all
$message="Dear $first_name,\n\n".
"Thank you for your order. We have received your payment and have processed your order, please do not disregard this email as it will serve as your receipt and also contains your software key code.\n\n".
"Order Details:\n".
"Description: $item_name\n".
"Price: $payment_amount\n\n".
"Instructions:\n".
"1. Download the Norman Installer from the following location: http://www.nothing.com\n".
"2. After running the installer you will be prompted to enter the key code, please copy and paste the following key code:\n\n".
"$result->key_code\n\n".
"3. For further information on using and installing Norman Antivirus please refer to the manual: http://download.norman.no/manuals/eng/N ... de_eng.pdf\n\n".
"This key is only valid for use on a single PC.\n\n".
"Thank you again,\n".
"The Nexgen Team\n\n";
Anyway, just split it up like so:
Code: Select all
$result = mysql_query("SELECT * FROM keymail WHERE used != '0' LIMIT '$quantity'");
$message="Dear $first_name,\n\n".
"Thank you for your order. We have received your payment and have processed your order, please do not disregard this email as it will serve as your receipt and also contains your software key code.\n\n".
"Order Details:\n".
"Description: $item_name\n".
"Price: $payment_amount\n\n".
"Instructions:\n".
"1. Download the Norman Installer from the following location: http://www.nothing.com\n".
"2. After running the installer you will be prompted to enter the key code, please copy and paste the following key code:\n\n";
while ($row = mysql_fetch_assoc($result)) {
$message .= $row['keycode']."\n"; // no idea how you store your information here.
}
$message .= "\n".
"3. For further information on using and installing Norman Antivirus please refer to the manual: http://download.norman.no/manuals/eng/N ... de_eng.pdf\n\n".
"This key is only valid for use on a single PC.\n\n".
"Thank you again,\n".
"The Nexgen Team\n\n";
Don't know exactly how you want it done, but if description, price, etc are all in the same table, or what. If they're in the same table, just move those lines inside the loop. If they're in a different table, you'll need to either get all the data from one table first or you can do a JOIN in the sql.
A note on your while loop... Change it to a foor loop and
use arrays.
Code: Select all
for ($i=0, $kodes=array(); $i < $quantity; $i++) {
$kodes[$i] = mysql_result(($result,$i,"key_code");
}
Or, if you want to spread it out a bit...
Code: Select all
$kodes = array();
for ($i=0; $i < $quantity; $i++) {
$kodes[$i] = mysql_result(($result,$i,"key_code");
}
Whichever.
