snrecords Posted April 22, 2008 Share Posted April 22, 2008 HI all ... I NEED HELP... I have a shopping cart working almost perfectly setup with Authorize.net AIM. All the variables are successfully being passed through to Authorize.net except for the ORDER #. The problem is that my variable is $order_id and it's not passing through or showing up after tests on my website. Here's the code : <input type="hidden" name="x_invoice_num" value="<? echo @$order_id; ?>"> Now looking back into my other code to see what $order_id is ... here's the code: // INSERT INTO ORDERS /* Start an order entry */ $q = "INSERT INTO orders "; $q .= "(user_id, vendor_id, order_number) "; $q .= "VALUES ("; $q .= "'" . $auth["user_id"] . "', '"; $q .= $ps_vendor_id . "', "; $q .= "'" . $order_number . "')"; $db->query($q); /* Get the order id just stored */ $q = "SELECT order_id FROM orders WHERE order_number = "; $q .= "'" . $order_number . "'"; $db->query($q); $db->next_record(); $order_id = $db->f("order_id"); $d['order_id'] = $order_id; $vars['order_id'] = $order_idb; Now by looking at this code ... it's my assumption that an order id is created and stored even though an order wasn't purchased yet (just my guess .. new to php). I have no idea what the correct variable is ... i tried $order_id, @$order_id, $d['order_id'], $order_number, $db->f("order_id"). None of these variables are showing any value when I input it into value="<? echo @$order_id; ?> How can I find the correct variable? There's nothing to retrieve from the database if the order never took place yet? right? How can I retrive something from the database that's not there yet. The row in the table of the database is named order_id in the table called orders and it's on autoincrement. Link to comment https://forums.phpfreaks.com/topic/102424-authorizenet-shopping-cart-help-1-variable/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.