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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL question

Status
Not open for further replies.

iffoiffy

Programmer
Feb 24, 2005
67
CA
Hi,

I have a variable

$Variable_A= "Honda Ford Chevy Toyota BMW";


In my database I have field "Field_1" which has a value "Ford"

Now In my SQL select I want to pick record only when value of "Field_1" exists in $Variable_A

How can I do that

Thanks


 
Assuming PHP

Code:
$q = "select <columnsOfInterest> from t
where field_1 in ('" . implode("','",explode(" ",$Variable_A)) . "')";

Untested.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top