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. "; } 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 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")) { 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 Quote 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. 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. Link to comment https://forums.phpfreaks.com/topic/268565-ifelseif-not-working/#findComment-1379353 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.