select help with php/mysql

liunx

Guest
Hi there

Quick question im just stuck on the select statement.....

This is the Scenario

3 tables in the DB

prod_description (products)
(this consists of all the products..i.e phones,games.ettc..etc.

comp_location (city)
(this consists of whichiever city the product is based in.i.e london,manchester etc..)

region
(this can be either, local,national, or regional)

now iw ant to do an advanced search for the following Scenarios)

i have a forms to do the job

the first seach option iwant to give the user is:

Search for a product in a City which is either (local,national, or regional) <<--this being as a drop down box

an example is:

"Mobile Phone from London which is based Locally"

the form is as follows

2 text box and 1 drop down and a sumbit button

first text box: user puts in product
second text box : user puts in city
3rd drop down menu: user can choose local.national or regional


<form name="form2" method="post" action="">
<strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Search
by Product<br>
Product
<input name="product" type="text" id="product">
City</font></strong>
<input name="city" type="text" id="city">
<select name="select2">
<option value="local">Local</option>
<option value="National">National</option>
<option value="Regional">Regional</option>
</select>
<br>
<input type="submit" name="Submit2" value="Search">
<br>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif">e.g
<strong>Mobile Phone</strong> from<strong> London</strong> which
is based <strong>Locally</strong> </font>
</form>


Second Search option is Display products by region

so here for example

i want to Search "london" and display all products that are Regional

here is the form code:

1 text box = user enters city
1 drop down menu = user can select local/national/or regional

so what it wants to do this one for example i want to display all products from london which are Local

<form name="form3" method="post" action="">
<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Search
by Competition Location Area</strong></font><br>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif">City</font>
<input name="city2" type="text" id="city2">
<select name="select3">
<option value="local">Local</option>
<option value="national">National</option>
<option value="regional">Regional</option>
</select>
<input type="submit" name="Submit3" value="Search">
<br>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif">e.g
All records that are Local to London</font>
</form>

can anyone help?

im just confused as to how i wud write the select statement!!!1

thanks in advanced

bye for now
sSearch for a product in a City which is either (local,national, or regional) <<--this being as a drop down box
you half said it right there.

select * from table where product LIKE '%$_POST["product"]%' AND city LIKE '%$_POST["city"]%' AND region = '$_POST["select2"]'


i want to Search "london" and display all products that are Regional
again you half said it right here.

select * from table where city LIKE '%$_POST["city"]%' AND region = '$_POST["select3"]'

this is saying that all your stuff is in 1 database.
 
Back
Top