Forum Moderators: coopster

Message Too Old, No Replies

PHP MySql 4 table query

what should be my query

         

Jaunty Edward

5:22 am on Dec 27, 2005 (gmt 0)

10+ Year Member



Hi,

I have these 3 tables in my DB.

1. tbl.Member

a. name
b. email
c. username(pri key) ...and other stuff

2. tbl.Product

a. id (pri key)
b. product name
c. category .... and other stuff
d. company(from table maker)

3. tbl.Maker

a. id (pri key)
b. company
c. email and other stuff

When the members are browing products they choose and purchase most of the products(atleast they apply). These orders will be stored in the 4th table.

4. orders

a. id
b. product name
c. maker
d. username (from tbl.members)....and other stuff.

The question is when a member with username jaunty is browsing the products I want to show him an indication that he has already purchased item no 5,9,15 etc.

assuming that I use the following query on the browse product page..

$query = select * from products;

how should I modify $query so that I can also indicate that jaunty has purchased some of them.

I am very sure this should be a small trick I just want to make sure my DB structure and queries are proper.

Please help me
Thanks

Jaunty Edward

4:33 am on Dec 28, 2005 (gmt 0)

10+ Year Member



well.... I don't think its a small trick....it seems to be very difficult now.

orion_rus

8:20 am on Dec 28, 2005 (gmt 0)

10+ Year Member



It's not a mysql query
You should make table with two fields username id
and place a username and id who buy products when you want to output this info you just make select with such username
Good luck to you!