laPistola Posted November 29, 2008 Share Posted November 29, 2008 <?php // Check if blocked $CBs = explode(',',$row_checkBlockedRS['blocked']); $CBa = array(); foreach($CBs as $key => $value) { array_push($CBa,$value); } if ($row_memberRS['id']==$CBa) { header("location: errors.php?status=blocked"); } ?> Im trying to make a condition in an if check to see if its value is in an array, i have checked everything and $row_memberRS['id'] = 1 and the array to $CBa looks like 1,1,1,1 so the condition in the if should read true or can you not check to see if a value lies in an array this way? Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted November 29, 2008 Share Posted November 29, 2008 look in to in_array Quote Link to comment Share on other sites More sharing options...
DarkWater Posted November 29, 2008 Share Posted November 29, 2008 Why are you doing array_push() to make an array of things that are already in an array? o_O Quote Link to comment Share on other sites More sharing options...
laPistola Posted November 29, 2008 Author Share Posted November 29, 2008 there not in an array its a string of data that taken straight from a DB field also i didn't think it would as easy as array($row) ??? anyway it works now thank you, i did in_array before i posted but got an error that made me think it wasn't the one to use, after the link to the manual i realised it was just the way i did it :-\ Thank you Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.