I am making a classifieds website... I have these 6 tables: Every category has sub-categories (or options) which you can see below.
Lets say the user wants to post a classified, and has entered all info into the forms necessary, and I am at the stage where I have to create the PHP code to actually INSERT the data into the database.
I am thinking something like this:
mysql_query("INSERT INTO classifieds (classified_id, ad_id, poster_id, cat_id, area_id, headline, description) VALUES ($classified_id, '$ad_id', $poster_id, $cat_id, $area_id, '$headline', '$description')");
But I don't know where to take it from here...
I think the posters table should not be like this, because how should I determine what the poster_id
should be? Or should I set it to auto-increment
?
Remember this, posters may not log in or anything, so there is no problem with one person having multiple poster_table records if you know what I mean.
classified_id
is a random unique value generated by PHP so that is always unique.
Please guide me! I don't know how to link the tables together correctly.
If you have any Q let me know and I will update this Q!
category table:
cat_id (PK)
cat_name
category_options table:
option_id (PK)
cat_id (FK)
option_name
option_values table:
value_id (PK)
option_id (FK)
value
classifieds table:
classified_id (PK)
ad_id (VARCHAR) something like "Bmw330ci_28238239832" which will appear in URL
poster_id (FK)
cat_id (FK)
area_id (FK)
headline
description
price
etc....
posters table:
poster_id (PK)
name
email
tel
password
area table:
area_id (PK)
area
community