[ create a new paste ] login | about

Link: http://codepad.org/YfkPBEaJ    [ raw code | output | fork ]

PHP, pasted on Sep 24:
1
2
3
4
5
6
7
8
9
10
11
12
13
<?php

$users = array('jim','mary','bob');

$userids = "USER_ID = '".implode("' \n   OR USER_ID = '",$users)."'";

echo "
SELECT *
FROM USERS
WHERE $userids
";

?>


Output:
1
2
3
4
5
6

SELECT *
FROM USERS
WHERE USER_ID = 'jim' 
   OR USER_ID = 'mary' 
   OR USER_ID = 'bob'


Create a new paste based on this one


Comments: