I suggest that you use a relational model for your DB. The Type should have its own table, as should OnlineHighstreet (although this isn't essential). Your main table should then have integers (tinyint) stored under these fields (foreign key on the other tables). This means that your 'dropdowns', should have the following structure:
<select id="type" name="type">
<option value="1">PC</option>
<option value="2">LAPTOP</option>
<option value="3">PC and LAPTOP</option>
</select>
The $_POST['type'] variable will then be either 1, 2 or 3. You then just search for the integer in your table.
diafol
Rhod Gilbert Fan (ardav)
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
It seems to me that you have a bit of an odd DB structure (sorry no offence intended).
Models
id (PK)
manufacturer (FK on manufacturer id)
name (e.g. Inspiron 1520)
description (blurb for model)
type (PC/Laptop)
Manufacturers
id (PK)
manufacturer_name
Retailers
id (PK)
retailer_name
onlineH
address_1
address_2
post_code
tel
fax
www
email
map_url
Stock
id (PK)
retailer_id (FK on retailer id)
model_id (FK on model id)
This structure should allow easy additions to each table.
SQL queries will require INNER JOINs.
I don't know if this helps.
diafol
Rhod Gilbert Fan (ardav)
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
Hi, no offence taken - i'm fairly new to all this so am greatful to any advise.
In reply to your comments, i can change the db format but at the moment I have one row for each retailer store and for the manaufactures i put them all into one field. If I have one retailer store for every invidicual brand i will end up with a huge database though?
No you won't - DBs can hold millions of records. At the moment you seem to be replicating data - which is a bit of a no-no with regard to DB design. Creating a 'relational model' will avoid errors, although it may look more complicated.
The the 'stock' table, to my mind, is essential, even though it seems as though it will be massive. However, if ALL stores/retailers stock exactly the same (ALL) models, you could dispense with this table.
If you use one table for everything, you are storing duplicate addresses, brand names etc etc. This setup invites errors. If a simple typo is made, your resultset will not list all records you expect.
diafol
Rhod Gilbert Fan (ardav)
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080