Modifying MySQL Where Statement Based on Array
Posted
by Ryan
on Stack Overflow
See other posts from Stack Overflow
or by Ryan
Published on 2010-05-22T21:35:09Z
Indexed on
2010/05/22
21:40 UTC
Read the original article
Hit count: 150
Using an array like this:
$data = array
(
'host' => 1,
'country' => 'fr',
)
I would like to create a MySQL query that uses the values of the array to form its WHERE clause like:
SELECT *
FROM table
WHERE host = 1 and country = 'fr'
How can I generate this query string to use with MySQL?
© Stack Overflow or respective owner