rahjiggah Posted September 19, 2012 Share Posted September 19, 2012 Hello, I have a while loop getting a mysql query, Im trying to do an if, elseif,else statement within it but its not working, can anyone see what Im missing? Thx. if ($row['pciaccom']="1" && $row['pciair']="1" || $row['issuerac']="1" && $row['issuerair']="1") { $acomm = " and paid for accomodations. "; } elseif ($row['issuerac']="0" && $row['pciaccom']="0") { $acomm = ""; } elseif ($row['issuerair']="0" && $row['issuerac']="1"]) { $acomm = " and " . $row['compname'] . " paid for accomodations. "; } else { $acomm = " and PooP Co. paid for accomodations. "; } Quote Link to comment https://forums.phpfreaks.com/topic/268565-ifelseif-not-working/ Share on other sites More sharing options...
mikosiko Posted September 19, 2012 Share Posted September 19, 2012 read: http://www.php.net/manual/en/language.operators.assignment.php and http://www.php.net/manual/en/language.operators.comparison.php Quote Link to comment https://forums.phpfreaks.com/topic/268565-ifelseif-not-working/#findComment-1379319 Share on other sites More sharing options...
coded4u Posted September 19, 2012 Share Posted September 19, 2012 Maybe try... if (($row['pciaccom']="1" && $row['pciair']="1") ||( $row['issuerac']="1" && $row['issuerair']="1")) { Quote Link to comment https://forums.phpfreaks.com/topic/268565-ifelseif-not-working/#findComment-1379321 Share on other sites More sharing options...
Jessica Posted September 19, 2012 Share Posted September 19, 2012 Maybe try... if (($row['pciaccom']="1" && $row['pciair']="1") ||( $row['issuerac']="1" && $row['issuerair']="1")) { No. OP: The links provided explain the different between a comparison and an assignment. Look at your code and compare. Quote Link to comment https://forums.phpfreaks.com/topic/268565-ifelseif-not-working/#findComment-1379325 Share on other sites More sharing options...
rahjiggah Posted September 19, 2012 Author Share Posted September 19, 2012 awesome thx for the hint... this is the third time I've made that mistake, gonna have to sticky it to my comp! @ me. Quote Link to comment https://forums.phpfreaks.com/topic/268565-ifelseif-not-working/#findComment-1379353 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.