hardening an array
Posted: Tue Jan 18, 2005 11:11 am
Here's the scenario. I've got an array of items for lookup in a db. I want to be able to go
I can't just do this, though, because the array of items came from user input. Specifically, from a text box exploded into the array. I can't addslashes before putting items into the array because I do all sorts of comparisons and what not on the array before it gets to this point. I don't want to loop through it becuase it could be big and I am trying to be optimal. I obviously can't addslashes after the implosion because I'm putting those quotes in there, which I need because it is an alphanumeric field and could have spaces.
So, any ideas?
Code: Select all
$findIn = implode("', '", $arrayItems);
$query = "SELECT * FROM `table` WHERE `ID` IN ('".$findIn."');";So, any ideas?