Good Mornin/Afternoon. I have a table that contains IDs. I am trying to validate the user input (many checkboxes on the screen) against these IDs.
Using SQL i can use the IN phrase to determin weather the input is IN the table. But this will require me to hit the table as many times as there are IDs.
I loaded the table IDs in an array and i am looping on the user input to determine existance of the IDs in the array. I have another loop that goes through the table array...... Not too good of a practice.
while ($i <= $UserInput_Count){
for ($j=0, $j<=$ID_Table_COUNT, $j++){
if ($UserInput == $ID_Table[j]){
$FOUND = true;
$i=9999;
break;
}
}
}
Instead of this, i am trying to employee something like the following method........ The question is does PHP have a similar control statment that allows me to acomplish it. (using the IN phrase)
if ($UserInput IN $ID_Table[j]){
......}
thanks
The "in" equivlence in PHP
Moderator: General Moderators
-
PingLeeQuan
- Forum Commoner
- Posts: 58
- Joined: Tue Sep 03, 2002 8:08 am
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK