eliezerazevedo Posted September 2, 2016 Report Share Posted September 2, 2016 (edited) How to make a FOQA system, eg if the pilot makes 10 legs and 5 is regeitada, so it will have a score of 50%. Based on this code: <? Php $ Add = mysql_query ("SELECT SUM (landingrate) the landingrate FROM` phpvms_pireps` WHERE pilotid = $ userinfo-> pilotid "); $ Total = mysql_fetch_array ($ total); $ V_total = Total $ [ 'landingrate']; $ Line = mysql_query ("SELECT * FROM` phpvms_pireps` WHERE pilotid = $ userinfo-> pilotid "); $ Rate = mysql_num_rows ($ line); $ V_taxa = $ rate; if ($ v_taxa <= 0) {$ V_media = 0; } Else {$ media = $ v_total / $ v_taxa; $ V_media = number_format ($ average, 0, '' '.'); } ?> <? Php echo $ v_media "%"?.; ?> Edited September 2, 2016 by eliezerazevedo Quote Link to comment Share on other sites More sharing options...
Moderators servetas Posted September 6, 2016 Moderators Report Share Posted September 6, 2016 I really can't understand what are you attempting to do. What is regeitada? Quote Link to comment Share on other sites More sharing options...
eliezerazevedo Posted September 6, 2016 Author Report Share Posted September 6, 2016 If the pilot does ten flights and those ten flights only five for approving the pilot will have an equivalent rating 50% It would be an average of accepted pireps. forgiveness for my English Quote Link to comment Share on other sites More sharing options...
Moderators servetas Posted September 6, 2016 Moderators Report Share Posted September 6, 2016 What is the above code for? Cause I saw that you are summing the landingrates.. Quote Link to comment Share on other sites More sharing options...
eliezerazevedo Posted September 6, 2016 Author Report Share Posted September 6, 2016 (edited) The code would almost it! Only instead to add the values, I want an average. Ex: Starts counting at 100% Value 0 (Approval Pending): Does not diminish the count. Value 1 (Approval Accepted): Increase count 1% up to the maximum value of 100% Value 2 (Approval Rejected): Decrease the count in 5% <?PHP $somar = mysql_query("SELECT SUM(accepted) as accepted FROM `phpvms_pireps` WHERE pilotid=$userinfo->pilotid"); $total = mysql_fetch_array($somar); $v_total = $total['accepted']; $linha = mysql_query("SELECT * FROM `phpvms_pireps` WHERE pilotid=$userinfo->pilotid"); $taxa = mysql_num_rows($linha); $v_taxa = $taxa; ?> <?php echo $taxa."%"; ?> This item will be shown in profile main.tpl Edited September 6, 2016 by eliezerazevedo 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.