snickers123 Posted August 27, 2013 Share Posted August 27, 2013 I have two arrays one with values set by the user to filter out certen foods, and saved to the db the other is a second set of values created when someone enters a recipe. These 9 vars can be set to either "yes" or "no". In this code the users filters are $Eggs22 and the recipe var are $Eggs without the 22. I have put together a small pice of code to do this but when I use the word "continue" to stop the filter and go back to the top of the while loop to get the next set of records to filter. If the $Eggs22 and $Eggs do not match I need to drop that record and get the new one and if they do match then it needs to just move to the next case: Can anyone see what I have done wrong I get the records weather the vars match or not. or is there an easier way. Still new to this . $n="no"; $k="yes"; switch ($n) { case $Eggs22: if($Eggs22!==$Eggs){continue;} case $Fruitose22: if($Fruitose22!==$Fruitose){continue;} case $Gluten22: if($Gluten22!==$Gluten){continue;} case $Lactose22: if($Lactose22!==$Lactose){continue;} case $Nuts22: if($Nuts22!==$Nuts){continue;} case $Soy22: if($Soy22!==$Soy){continue;} } switch ($k) { case $LowFat22: if($LowFat22!==$LowFat){continue;} case $Diabetice22: if($Diabetice22!==$Diabetice){continue;} case $Vegan22: if($Vegan22!==$Vegan){continue;} } Link to comment Share on other sites More sharing options...
Larry Posted August 28, 2013 Share Posted August 28, 2013 I really don't understand your example and you don't have a loop in the code you've posted. I also don't know why you're assigning "no" and "yes" to variables and doing switches on them. I could probably make some recommendations if I better understood what's going on. Could you rephrase your situation and perhaps show some values? Link to comment Share on other sites More sharing options...
Recommended Posts