NWA1999 Posted July 6, 2019 Report Share Posted July 6, 2019 Hi, I'm trying to code functionality within the PIREPData class to divide the inputted passenger amount up into first class, business class, and economy class, all randomized but all passengers will make it. Here's what I've coded $ac = OperationsData::getAircraftByReg($pirepdata['aircraft']); $rem=$pirepdata['load']; if ($rem<=$ac->firstclass) { $first=rand(0,$rem); $rem-=$first; } else { $first=rand(0,$ac->firstclass); $rem-=$first; } if ($rem<=$ac->busclass) { $bus=rand(0,$rem); $rem-=$bus; } else { $bus=rand(0,$ac->busclass); $rem-=$bus; } $econ=$rem; $rem-=$econ; $pirepdata['fclasscount']=$first; $pirepdata['bclasscount']=$bus; $pirepdata['eclasscount']=$econ; However all passengers get put in economy. I know my issue is lines like $ac->firstclass, and $ac->busclass. What should these lines be? These values are in my SQL aircraft table as firstclass, and busclass columns of each row (aircraft) . Thanks Robbie Quote Link to comment 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.