Jump to content

ccompass

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Posts posted by ccompass

  1. Here are the two tables:

     

    orderdetails

    -------------------------

    DetailID (PK)

    DetailOrderID

    DetailProductID

    EventID

    DetailName

    DetailPrice

    DetailQuantity

     

    orders

    ------------------------

    OrderID (PK)

    OrderAmount

    OrderShipName

    OrderShipAddress

    OrderCity

    OrderState

    OrderZip

    OrderPhone

    OrderEmail

    OrderDate

     

    This code seems to work, but I don't know how to query the $result array.

     

    $result = mysql_query("SELECT * FROM orderdetails WHERE EventID =" . $_GET['EventID']) or die(mysql_error());  
    
    while($row = mysql_fetch_array($result)){
    echo "DetailID: " . $row['DetailID'] . " | DetailOrderID: " . $row['DetailOrderID'] . "<br>";
    }

     

     

     

  2. I have three tables: events, orderdetails & orders.

     

    First I query orderdetails to find all the records that match the EventID:

     

    $query1 = SELECT * FROM orderdetails WHERE EventID = $_SESSION['EventID'];

     

    This returns 4 records.  These 4 records have a field called DetailOrderID which is the foreign key for orders.OrderID.  Next I need to query the results of the first query to find all the records in the orders table that match up.  For example:

     

    SELECT * from orders where $query1.DetailOrderID = orders.OrderID.

     

    How would I go about doing this?  I'm head down the temporary table solution but wanted to through this one out for discussion before I invest too much time.

×
×
  • 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.