Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

query probs

Status
Not open for further replies.

csniffer

Programmer
Apr 30, 2003
161
GB
hi all,
i have this query but i want to take it one step further by searching 3 extra fields in the same table called jobchoice1, jobchoice2, jobchoice3, how can i expand the WHERE. Would it be something like: WHERE (town = '$town') AND (field1 = '$somevar' or field2 = '$somevar' of field3 = '$somevar');
this what i have at the moment
Code:
$query = "SELECT firstname, lastname, emailaddress, town from studentdetails WHERE town = '$town'";

i have tried this but it does not work, could some point out whare i am going wrong

To err is human, to completely mess up takes a computer. [morning]
 
Using

Code:
WHERE (town = '$town') AND (field1 = '$somevar' or field2 = '$somevar' of field3 = '$somevar')

should work. What's the problem?
 
thx i will double check my punctuation

To err is human, to completely mess up takes a computer. [morning]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top