Jump to content

jay83rr

New Members
  • Posts

    6
  • Joined

  • Last visited

Posts posted by jay83rr

  1. i managed to do it another way, by doing a LEFT JOIN and it gave me the desired result. I would like to try and consolidate my queries but it's so confusing as it reads data from multiple tables and queries them to give a result.

     

    also the fact that im trying to do something that im a novice at creates more problems!

  2. i think the error is in query3 im not sure if i've formatted this correctly.

     

     

    <?php
    session_start();
    //printf('<pre>%s</pre>', print_r($_SESSION, true));
    require('includes/config.inc.php');
    require('includes/session.php');
    //WORKING
    DB_Connect();
    $query = "SELECT * FROM food_delivery_orders_items WHERE food_delivery_orders_items.type = 'product' AND food_delivery_orders_items.order_id=".$_SESSION['pdf_quote']['id']."";
      
    $result = mysql_query( $query) or die(mysql_error());
    while($row = mysql_fetch_assoc($result))
       {
       $hash = $row['hash'];
       $foreignid = $row['foreign_id'];
        $qty = $row['cnt'];     
       }
       
         
    $query2 = "SELECT * FROM food_delivery_products WHERE food_delivery_products.id = ".$foreignid."";
    $result2 = mysql_query( $query2) or die(mysql_error());
    while($row = mysql_fetch_assoc($result2))
       {
       $name = $row['name'];
       $description = $row['description'];    
       }
     
     
     //---------------------------------------------------------------------------------------------------------------
     
     $query3 = "SELECT * FROM food_delivery_orders_items WHERE food_delivery_orders_items.type = 'extra' AND food_delivery_orders_items.order_id=".$_SESSION['pdf_quote']['id']."";
      
    $result3 = mysql_query( $query3) ;
    while($row = mysql_fetch_array($result3))
       {
     
       $foreignidextra = $row['foreign_id']; 
       $qtyextra = $row['cnt'];   
       }
       print $row;
       
       $query4 = "SELECT * FROM food_delivery_extras WHERE food_delivery_extras.id = ".$foreignidextra."";
    $result4 = mysql_query( $query4) or die(mysql_error());
    while($row = mysql_fetch_array($result4))
     
       {
       $nameextra = $row['name'];
         
       }
     echo $nameextra;
     echo $qtyextra;
    DB_Disconnect();
     
     
    //$products = implode(", ",$_SESSION['pdf_quote']['product_arr']);;
    //print $products
    ?>
    
  3. when i run that i get the following but it still won't show me the contents of product_arr 

     

    i think i need to implode to get the array... but thats where i get lost.

    Array(    [id] => 46    [location_id] => 4    [type] => pickup    [status] => pending    [payment_method] => none    [is_paid] => 0    [txn_id] =>     [processed_on] =>     [price_subtotal] => 3125.00    [price_delivery] => 0.00    [price_total] => 3125.00    [voucher_code] =>     [created] => 2013-10-15 21:12:20    [p_dt] => 2013-10-25 08:00:00    [d_address_1] =>     [d_address_2] =>     [d_country_id] =>     [d_state] =>     [d_city] =>     [d_zip] =>     [d_notes] =>     [d_dt] =>     [c_name] => test    [c_email] => test@test.com    [c_phone] => 8298392832    [c_address_1] => eokeoj    [c_address_2] =>     [c_notes] =>     [c_country] =>     [c_state] => test    [c_city] =>     [c_zip] => 2000    [cc_type] =>     [cc_num] =>     [cc_code] =>     [cc_exp] =>     [product_arr] => Array        (            [0] => Array                (                    [extra_arr] => Array                        (                        )                )        ))
×
×
  • 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.