hello!

i'm implementing an e-commerce system to distribute key codes.

right now i'm thinking of a sql syntax to do the following:

i have a table: orders

here i have the orders_id field (unique for each order placed)

with this orders_id field there may be more than one products ordered therefore in the products_id field i can have the following situation:

orders_id: 101
products_id: 13
orders_id: 101
products_id: 43
orders_id: 101
products_id: 1

so i have three rows with the same orders_id but different products_id

now i want to grab the value of these products_id for the specified orders_id (p.s. i can provide the orders_id value already)

any ideas? i'm a little stuck on this..

thanks

how about select product_id from orders where order_id=? This will give you all product_ids for a order

yes,
if you put your order_id in session, after order is completed,then make your session destroy...
then you can write that query as:

select product_id from orders where order_id='".$_SESSION['sess_order_id']."'

So, this will not disturb any other orders...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.