oasisp
Posts: 48
|
| Posted: 09/20/2010, 3:41 PM |
|
is there a CC php function for Retrieves multiple records?
i have invoice table and order_items table using relation between invoiceid field. i have multiple items on order_items for invoiceid which is unique on invoice table.
i am trying to Retrieves all the items (qty, partnumber, partdesc, price) from order_items which has multiple invoice number for items.
i need similar function like CCDLookUp i am using this order email confirmation.
i tired using CCDLookUp but if i have multiple items for that order it only email top first row.
i appreciate your help
|
 |
 |
datadoit
|
| Posted: 09/20/2010, 5:56 PM |
|
global $YourConnection;
$db = new clsDBYourConnection();
$sql = "SELECT this FROM that WHERE this = that";
$db->query($sql);
while ($db->next_record())
{
do this, that and the other;
}
$db->close();
|
|
|
 |
oasisp
Posts: 48
|
| Posted: 09/21/2010, 10:16 AM |
|
didnt worked
HERE IS MY BEFORE SHOW event code after submit order for order email confirmation
$db2 = new clsDBconn2();
$MainPage->Connections["conn2"] = & $db2;
global $emailBody;
$emailBody = "";
$emailBody = $emailBody."<html><head><title>Parts Online Ordering - Order Corderfirmation</title></head><body>";
//BELOW CODE IS NOT WORKING. TRYING TO RETRIVE MULTIPLE RECORDS ROW OF ITEMS FROM INVOICE2 TABLE FOR ORDER ITEMS
$sql = "SELECT QTYORDER,PARTNUM,SERIALNUM,DESCRIPT,UNITPRIC FROM INVOICE2 WHERE INVOICENUM= $invoicenum";
$db2->query($sql);
while ($db2->next_record())
{
$emailBody = $emailBody."<tr class='Row'><td>".$QTYORDER ."</td> <td>".$PARTNUM ."</td><td>".$SERIALNUM ."</td> <td>".$DESCRIPT ."</td> <td><p align='right'>".$UNITPRIC ."</p></td></tr>";
}
$emailBody = $emailBody."</table> </td> </tr></table><table border='0' cellspacing='2' cellpadding='2' width='760' align='center'> <tr> <td valign='top'><table border='0' cellspacing='0' cellpadding='0' width='760'><tr><td><strong>Order Totals </strong></td> </tr></table>";
$emailBody = $emailBody."<p align='center'></p></td> </tr></table></th></tr></table></body> </html>";
|
 |
 |
materix
Posts: 161
|
| Posted: 09/24/2010, 9:41 AM |
|
Why do you write? $MainPage->Connections["conn2"] = & $db2
|
 |
 |
ab5ni
Posts: 177
|
| Posted: 09/27/2010, 4:46 PM |
|
I believe there is a bug in the <td> defs you have, although it's really hard to read because of the formatting.
Regards...
_________________
Randall Jouett
Amateur Radio: AB5NI
I eat spaghetti code out of a bit-bucket while sitting at a hash table! And yes, I paid for the meal in cache!
|
 |
 |
oasisp
Posts: 48
|
| Posted: 09/28/2010, 4:51 PM |
|
i am using 2 database. db2 is connect to diffrent database
|
 |
 |
hidran
Posts: 29
|
| Posted: 09/30/2010, 8:53 AM |
|
You have to give your vars some values from your query:
$QTYORDER=$db2->f('QTYORDER');
and so on
|
 |
 |