alexandre Posted September 28, 2022 Share Posted September 28, 2022 no matter what i tried , nothing is working and i have tried every single array functions. i need to compare $value1 with the $_SESSION['id'] $winners1[] = array_slice($WINNERSID, 0, $num_winners3); if ($winners2 = array_filter($winners1)) { foreach ($winners2 as $value1) { if (in_array(intval($_SESSION['id']), $value1) && $prizepaid == false) { value1 contains this: array(2) { [0]=> string(2) "24" [1]=> string(2) "25" } normally i believe it shouldnt be so complicated to see if the user id is the same as one of those numbers from the array.. Quote Link to comment https://forums.phpfreaks.com/topic/315378-cannot-get-this-array-of-value-compared-with-the-session-id-superglobal/ Share on other sites More sharing options...
ginerjm Posted September 28, 2022 Share Posted September 28, 2022 Just a quick thought - doesn't the function in_array kinda do this for you? Your code is only looking for a single array element, no? So it's s/b quick Quote Link to comment https://forums.phpfreaks.com/topic/315378-cannot-get-this-array-of-value-compared-with-the-session-id-superglobal/#findComment-1601125 Share on other sites More sharing options...
alexandre Posted September 28, 2022 Author Share Posted September 28, 2022 28 minutes ago, ginerjm said: Just a quick thought - doesn't the function in_array kinda do this for you? Your code is only looking for a single array element, no? So it's s/b quick dont worry i finally got it working after a week stuck on this $WINNERSID[] = intval($WINNERS_ROW['participationid']); $winners1[] = array_slice($WINNERSID, 0, $num_winners3); if ($winners = array_filter($winners1)) { foreach ($winners as $value) { if (in_array($_SESSION['id'], $value) && $prizepaid == false) { i simply removed the intval() from the $_SESSION id and stored the ids as int into the winnersid array. i so much tried every single thing i could on this one this has to be the simplest thing i had to change .. this is hilarious . Quote Link to comment https://forums.phpfreaks.com/topic/315378-cannot-get-this-array-of-value-compared-with-the-session-id-superglobal/#findComment-1601126 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.