whats wrong ?? functions&vars
| From: | David Walgamotte | Date: | Mon, 13 Nov 2000 19:26:34 +0000 |
| Subject: | whats wrong ?? functions&vars | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-25017@lists.php.net to get a copy of this message | ||
I know its something that I'm doing wrong, the theory of operation is 2 add
the data to a database and a flat file. The db add works the flat file add
errors with "Undefined variable:". what's wrong ?
function create_order(&$order) {
global $SESSION;
/* build the custinfo string */
/* I need to pull this in the below function*/
$custinfo =
"Customer : $order->customer\n"
. "Contact : $order->contact\n"
. "Address : $order->address\n"
. "Credit Card: " . chop_ccnum($order->creditcard) . "
expiry $order->expiry\n";
/* save order information first */
$qid = db_query("
INSERT INTO orders (
username, o_timestamp, status, custinfo, comments, amount
) VALUES (
'{$SESSION["user"]["username"]}'
,now()
,1
,'$custinfo'
,'$order->comments'
,'{$SESSION["cart"]->total}'
)");
$orderid = db_insert_id();
/* now add the shopping cart items into the order_items table */
$qid = get_cart_items();
while ($item = db_fetch_object($qid)) {
db_query("
INSERT INTO order_items (
order_id, product_id, price, qty
) VALUES (
'$orderid'
,'$item->id'
,'$item->price'
,'{$SESSION["cart"]->items["$item->id"]}'
)");
}
return $orderid;
}
" IN RED IS WHERE THE PROBLEM IS "
function authorize_payment(&$orderid, &$status, &$status_details) {
// $filewrite will write order data to a flat file
$DATE = date("z");
$filename ="/reports/$DATE";
$fp = fopen( $filename,"a");
fwrite( $fp, "------------------------ \n");
fwrite( $fp," ORDER ID = " . "$orderid \n");
fwrite( $fp," CUSTOMER = " . "$order->custinfo \n");
fwrite( $fp," CONTACT = " . "$order->contact \n");
fwrite( $fp," SHIPPING ADDRESS = " . "$order->address \n");
fwrite( $fp," CREDIT CARD NUMBER = " . "$order->creditcard \n");
fwrite( $fp, "------------------------ \n");
fclose( $fp );
$status = 1;
$status_details = "Order completed successfully";
return true;
}
thks dave