creata.physics Posted May 31, 2011 Share Posted May 31, 2011 So on my website I have a basic if statement that checks some arguments to see if a user can add another user as a friend. Well I had gotten that part down and for the longest time other people on my website have been able to use the feature. Now all of a sudden the if statement doesn't work? Why? Here is the statement: if ($privacy['privacy']['who_can_add'] == '1' AND $zext->user['id'] != '0' AND $zext->user['id'] != $u['id']) { $add_friend = $u['add_friend']; } of course if I put $add_friend outside the if statement, the button appears. How can a statment work one day but not the other? Is it an issue with my server? dump of $privacy: $ => Array (4) ( | ['hide_o_status'] = Integer(1) 0 | ['who_can_view'] = Integer(1) 1 | ['who_can_add'] = Integer(1) 1 | ['who_can_contact'] = Integer(1) 1 ) dump of $zext->user['id']: $ = String(2) "10" dump of $u['id']: $ = String(2) "4" it all has correct information and the if statement has not been changed from before when it had worked and outputted $add_friend all day long. it worked until last night, i don't know what happened or why, php version has not been changed or anything. if anybody has any ideas on what's going on help would be much appreciated. Thanks, Matt. Quote Link to comment https://forums.phpfreaks.com/topic/238041-if-statement-works-one-day-broken-the-other/ Share on other sites More sharing options...
requinix Posted June 1, 2011 Share Posted June 1, 2011 dump of $privacy: Is that a dump of $privacy or $privacy["privacy"]? Quote Link to comment https://forums.phpfreaks.com/topic/238041-if-statement-works-one-day-broken-the-other/#findComment-1223261 Share on other sites More sharing options...
darkfreaks Posted June 1, 2011 Share Posted June 1, 2011 have you thought about using ternary operators $add_friend = $u['add_friend']; $action =($privacy['privacy']['who_can_add'] == '1' && $zext->user['id'] != '0' && $zext->user['id'] != $u['id'] && $zext->user['id'] != 'NULL') ? $add_friend : 'Sorry Unable to retrieve Zext User ID!'; Quote Link to comment https://forums.phpfreaks.com/topic/238041-if-statement-works-one-day-broken-the-other/#findComment-1223263 Share on other sites More sharing options...
creata.physics Posted June 1, 2011 Author Share Posted June 1, 2011 dump of $privacy: Is that a dump of $privacy or $privacy["privacy"]? sorry, it's dump of privacy['privacy']. @darkfreaks, i can try it, but i'm more worried about how my script stopped working out of nowhere. the if statement is correct and there aren't any errors, so why would it work one day and not the other? I've tested this on zext.org which is the main website, and also on my localhost. zext.org has had the same code and has not been altered and that is where i found the issue. i've cleared my browser cache and what not and it's still doing it, why would it do this? how? Quote Link to comment https://forums.phpfreaks.com/topic/238041-if-statement-works-one-day-broken-the-other/#findComment-1223281 Share on other sites More sharing options...
creata.physics Posted June 1, 2011 Author Share Posted June 1, 2011 never mind guys. this was an issue with the user table retrieving the serialized array, please mark this topic as solved. Quote Link to comment https://forums.phpfreaks.com/topic/238041-if-statement-works-one-day-broken-the-other/#findComment-1223284 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.