Hey there i'm attempting to build one database for any online shop my problem definition is a purchase can consists of many products with various delivery dates for instance 1 book will require a couple of days to provide another take 4-five days to provide.

I've got a Product table which consists of product delivery time like 2-3 business days or 4-5 business days

During my delivery table how can i illustrate this since it consists of 1 order id i'm able to show the consumer the maximum time like five days for that delivery but how do i show the rear consumer 2 different order timings and status of just one order

How do i demonstrate to them into my delivery table because they are one order but getting different delivery occasions..

It is a 1:1 relationship between products and delivery dates. Either result in the foreign key relationship involving the ITEM and DELIVERY tables or give a DELIVERY_DATE column towards the ITEM table.

The problem comes whenever you think the connection is between order and delivery date.

You'll need a method to roll-up all of the products within the to develop a general delivery date. You might like to give customers a chance to drill lower to determine the particulars, item by item.

You maybe can perform query such as this:

$rowset = $db->fetch_all( 'SELECT ... FROM orders
    INNER JOIN products ON ...
    INNER JOIN delivery ON ...
    ORDER BY products.id, delivery.date
    WHERE ...');

This makes that you will have record/row for every delivery date entry (you are able to group them by date then or make a move similar).

After which browse all of them by code such as this:

$productID = 0;
foreach( $rowset as $row){
    if( $productID == $row.productId){
        // Code for multiple dates
    } else {
        // Code for new item
    }
    $productID = $row.productId
}

Performs this fit?