I'm passing an argument to my php code using a web brower in the following format:
www.site.php?age=1&sex=2
Then in the code accessing those arguments:
'age' => $_GET['age']
'sex' => $_GET['sex']
One argument needs to be a set of comma separated values (ie, "1,2,3,4,5"). When I do the following, only the first value gets interpreted:
www.site.php?age=1&sex=2&nums=1,2,3,4,5
I've tried with parens, brackets, etc., which all break the code. Any thoughts? Thanks,
EDIT: I incorrectly assumed when the error occurred. The error occurs when trying to actually make the sql call:
This works:
$sql = <<<SQL
SELECT * from db
WHERE age=:age AND nums in (1,2)
SQL;
$query = $dbs['base']['connection']->prepare($sql);
$query->execute(array(
':age' => $_GET['age'],
));
But it fails when I pass in the nums:
$sql = <<<SQL
SELECT * from db
WHERE age=:age AND nums in (:nums)
SQL;
$query->execute(array(
':age' => $_GET['age'],
':nums' => $_GET['nums']
));
When I just print $_GET['nums'], the comma separated values come in just fine. How can I properly pass the 'nums' argument to the sql query?