Jump to content

jakebur01

Members
  • Posts

    885
  • Joined

  • Last visited

Everything posted by jakebur01

  1. Thank you! But now how to I retrieve the rows from the array and echo them onto the page from here?
  2. ok ok, i see now it returns this Array ( [0] => Array ( [orderid] => 14 [isbn] => 30-015 [item_price] => 15.82 [quantity] => 1 ) ) 1 with this code: $query = "SELECT * FROM order_items WHERE orderid = '$coolid'"; $result = mysql_query($query, $db) or die(mysql_error()); while ($row = mysql_fetch_assoc($result)) { $rows[] = $row; } echo '<pre>' . print_r($rows) . '</pre>';
  3. This is what it returned. It's all jumbled up. Array ( [orderid] => 15 [isbn] => C100016 [item_price] => 50.37 [quantity] => 1 ) 1
  4. What do I do when I am retrieving multible rows, like from the order items table where I have 5 rows where the orderid column equals 14 ? How do I store those rows into variables? `Jake
  5. so would i do three seperate querys under one connection? Like: $conn = db_connect(); //then $query = select * from customers where //then do a second query?? $query = select * from orders where //and a third?? $query = select * from order_items //??? I'm not sure exactly how to separate them???
  6. Whatever would work best? I don't know exactly what I need to do, I just know what I want to do and I don't know exactly how to get it done.
  7. Ok, I am trying to join 3 tables together to retrieve information to display on an invoice. I am new to joining tables and I keep confusing myself. Heres what I've got: customers table - has customerid, name, address, city, state, zip, and country orders table - has orderid, customerid, amount, date, order_status, ship_name, ship_address, ship_city, ship_state, ship_zip, ship_country, c_phone, c_email, card_type, card_number, card_month, card_year, card_name order_items table - has orderid, isbn, item_price, and quanity Here's what i'm trying to do: display address display shipping address display orders display credit card information Thank you, `Jake
  8. Man!!! it works now!! Thank you for helping me... I really appreciate it! `Jake
  9. this got it in mysql: WHERE `orders` . `ship_name` = 'kirby';
  10. MySQL said: Documentation #1054 - Unknown column 'orders.ship_name' in 'where clause' Also, I wasn't retrieving my session on this page: function process_card($card_details) { $name = $_SESSION['customer_name'];
  11. The data is inserting perfect on the previous page but is still not updating the credit card info. I appreciate you taking the time to help me though jitesh.
  12. Does this part of my code look ok? if($_SESSION['cart']&&$c_phone&&$c_email&&$card_type&&$card_number&& $card_month&&$card_year&&$card_name ) { //display cart, not allowing changes and without pictures display_cart($_SESSION['cart'], false, 0); display_shipping(calculate_shipping_cost()); if(process_card($_POST)) { //empty shopping cart session_destroy(); echo 'Thankyou for shopping with us. Your order has been placed.'; display_button('index.php', 'continue-shopping', 'Continue Shopping'); }
  13. orderid customerid amount date order_status ship_name ship_address ship_city ship_state ship_zip ship_country c_phone c_email card_type card_number card_month card_year card_name Edit Delete 8 13 5.27 2007-05-25 PARTIAL test test test test test test 0 0 0 0 0 0 0 I am trying to tell it what row I want it to update to. ship_name is the name of a column where the customers name is stored, I was trying to get it to store the data where the customers name that is stored in the session matches the name in that column.
  14. I changed it to this: <?php function process_card($card_details) { extract($card_details); $conn = db_connect(); // insert customer address $query = "UPDATE `orders` SET `c_phone` = '$c_phone', `c_email` = '$c_email', `card_type` = '$card_type', `card_number` = '$card_number', `card_month` = '$card_month', `card_year` = '$card_year', `card_name` = '$card_name' WHERE `orders` . `ship_name` = '$name'"; /// where // name = '$name' and address = '$address' // and city = '$city' and state = '$state' // and zip = '$zip' and country = '$country'"; $result = $conn->query($query); return true; } still no dice... I don't know what the deal is..
  15. ok, I have inserted all the customers info into all the necessary tables on the previous page. Also, on the previous page the customer enters in their credit card info.. Now on this page I am trying to update the credit card info into the orders table. I am having trouble getting the data to go in. <?php include ('book_sc_fns.php'); // The shopping cart needs sessions, so start one session_start(); do_html_header('Checkout'); $c_phone = $_POST['c_phone']; $c_email = $_POST['c_email']; $card_type = $_POST['card_type']; $card_number = $_POST['card_number']; $card_month = $_POST['card_month']; $card_year = $_POST['card_year']; $card_name = $_POST['card_name']; $name = $_SESSION['customer_name']; $address = $_SESSION['customer_address']; if($_SESSION['cart']&&$c_phone&&$c_email&&$card_type&&$card_number&& $card_month&&$card_year&&$card_name ) { //display cart, not allowing changes and without pictures display_cart($_SESSION['cart'], false, 0); display_shipping(calculate_shipping_cost()); if(process_card($_POST)) { //empty shopping cart session_destroy(); echo 'Thankyou for shopping with us. Your order has been placed.'; display_button('index.php', 'continue-shopping', 'Continue Shopping'); } else { echo 'Could not process your card. '; echo 'Please contact the card issuer or try again.'; display_button('purchase.php', 'back', 'Back'); } } else { echo 'You did not fill in all the fields, please try again.<hr />'; display_button('purchase.php', 'back', 'Back'); } do_html_footer(); ?> And here is the process_card() function. <?php function process_card($card_details) { extract($card_details); $conn = db_connect(); // insert customer address $query = "UPDATE 'orders' SET 'c_phone' = '$c_phone', 'c_email' = '$c_email', 'card_type' = '$card_type', 'card_number' = '$card_number', 'card_month' = '$card_month', 'card_year' = '$card_year', 'card_name' = '$card_name' WHERE 'orders' . 'ship_name' = '$name'"; $result = $conn->query($query); return true; } I still have a lot to learn, but I am starting to see things a little more clearly. `Jake
  16. I see what your saying. So, after I insert the data into the customers table and orders table. Then, I retrieve the customer id or order id that the mysql database auto_incremented, store it into a session, then get the session on my credit card page ,......then insert the customer or order id into the credit card table along with the credit card info. ?
  17. what if we want to add an insert on the next page inserting credit card info into table. How would I link the customer id in this table with my customer and orders tables? `Jake
  18. ha.. yea.... so I would need to have the credit card script check to see what the last order number is in the customers table the auto increment from that?? I'm starting to visualize all this.... It just takes me a couple of times to get stuff...
  19. If info is submitted into the customer table, orders table, and shipping table but not in the credit card table wouldn't it throw things off balance if I were relying on auto_increment?
  20. I need to create some kind of random number within a persons session that can be inserted into a customer id column for their orders, customer, and credit card tables. Unless their is a better way to link a customers information together between a few tables besides using auto increment. Things could get screwed up for me if I use auto increment, especially if someone submits their information but does not actually place an order. My question is " How can I create a random order number that can be used within a persons session and will stay the same throughout the whole program for that one person? " I have just started learning about sessions so please bear with me. Thank you, Jake
  21. These worked GREAT!! Thank you so much. It really saves me a lot of time not having to type all of those and where isbn = over and over.... this is my first time really playing with the update command.. I'll hang on to that php code using update as well.. Thank you all.. `Jake
  22. Here's my issue. I have 80,000 products I am creating categories for. I am attemping to do an update on a column that already has a three character symbol. I am replacing the three character symbols with my new symbol on each row in the table according to which product I want in the category. This query I have been trying is throwing me back errors. update books set catid = "J01" where isbn = '30-097' and where isbn = '30-072' and where isbn = '30-022' and where isbn = '30-918' and where isbn = '30-132' and where isbn = '30-075' and where isbn = '30-923' and where isbn = '30-044' and where isbn = '30-825' and where isbn = '30-920' and where isbn = '30-101' and where isbn = '30-809' and where isbn '69-002' and where isbn = '30-929' and where isbn = '30-761' and where isbn = '30-104' and where isbn = '30-811' and where isbn = '69-003' and where isbn = '30-105' and where isbn = '30-106' and where isbn = '30-094' and where isbn = '30-107' and where isbn = '30-827' and where isbn = '30-924' and where isbn = '30-108' and where isbn = '30-134' and where isbn = '30-048' and where isbn = '30-820' and where isbn = '30-926' and where isbn = '30-049' and where isbn = '30-803' and where isbn = '69-006' and where isbn = '30-925' and where isbn = '30-039' and where isbn = '30-029' and where isbn = '30-821' and where isbn = '69-829' and where isbn = '30-930' and where isbn = '30-033' and where isbn = '30-824' and where isbn = '69-333' and where isbn = '30-915' and where isbn = '30-700' and where isbn = '30-813' and where isbn = '30-038' and where isbn = '30-720' and where isbn = '30-731' and where isbn = '30-928' and where isbn = '30-710' and where isbn = '30-800' and where isbn = '69-036' and where isbn = '30-927' and where isbn = '30-961'; My quesion is: Does anyone have any suggestions on a better way to do this? or How could I get the above query to work? Thank you, Jake
  23. That makes a lot of sense. Thank you.
  24. I was wondering if anyone has had any trouble with serialize() and unserialize() after updating to the new version of php. My friend called me, he has a shopping cart where he puts the selected items product number, price and stuff in variables then into an array then serializes it. He has been passing it into another page then unserializing it. Since updating to the latest version of php he gets this: Error: PHP Warning: extract() [function.extract]: First argument should be an array in C:\Inetpub\JetSkiHaven.com\cart\custinfo_level1.php on line 57 His cart was working fine before the update. I feel like an idiot posting on here without any code. I was hoping someone has experience something close to this. Thank you, Jake
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.