hoachen Posted October 27, 2006 Share Posted October 27, 2006 Hi guys, I need some help with you. I try to echo the data from the database but i have to check one specific column(status). If that column contain 'pending' or 'cancelled' then this rows will not be echo else echo all the data. Here is what i have try but it echo everything outwhile ($mod = $objIncident->fetch()) { $showstat = $data->getStatus(); if ($showstat != "pending" || $showstat != "cancelled" ) { echo $data->getName(); echo $data->getCity(); echo $data->getComplaints(); } else { echo ''; } Link to comment Share on other sites More sharing options...
aspnetguy Posted October 27, 2006 Share Posted October 27, 2006 it is a simple mistake, look at your conditionif($showstat != "pending" || $showstat != "cancelled")think about it for a second...the answer to that condition will ALWAYS be true so that is why it always echos the data.Change || to && and you should be fine. Link to comment Share on other sites More sharing options...
hoachen Posted October 27, 2006 Author Share Posted October 27, 2006 I see, thanks for you sharpe spot. I got it works now. THanks it is a simple mistake, look at your conditionif($showstat != "pending" || $showstat != "cancelled")think about it for a second...the answer to that condition will ALWAYS be true so that is why it always echos the data.Change || to && and you should be fine. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now