faraz Posted January 8, 2010 Report Share Posted January 8, 2010 HI I want Add Total Hours This Month and Total Flight This Month in profile_main ( Pilot Center) ! I added some code in StatsData , but doesn't work!! I have problem with date filter ... Finlay I used this code directly in profile_main $dateFilter = date("Y-m-d", mktime(0,0,0,date("m"),date("d")-30,date("Y"))); $toDay = date("Y-m-d"); $datecondition = "where FlightDate BETWEEN '".$dateFilter."' AND '".$toDay."'"; Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted January 9, 2010 Administrators Report Share Posted January 9, 2010 For total hours in a month, you can do: $hours = PIREPData::getIntervalDataByMonth(array(), 1); echo $hours->total; For total flights: $flights = PIREPData::findFlights(array('DATE_SUB(CURDATE(), INTERVAL 1 MONTH) <= p.submitdate')); $total = count($flights); 1 Quote Link to comment Share on other sites More sharing options...
faraz Posted March 18, 2010 Author Report Share Posted March 18, 2010 Thank you Nabeel . Those codes doesn't work for me . Quote Link to comment Share on other sites More sharing options...
faraz Posted March 20, 2010 Author Report Share Posted March 20, 2010 can anybody help me! Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted March 20, 2010 Administrators Report Share Posted March 20, 2010 What happens? Need some more info Quote Link to comment Share on other sites More sharing options...
faraz Posted March 20, 2010 Author Report Share Posted March 20, 2010 $flights = PIREPData::findFlights(array('DATE_SUB(CURDATE(), INTERVAL 1 MONTH) <= p.submitdate')); $total = count($flights); changed to $flights = PIREPData::findPIREPS(array('DATE_SUB(CURDATE(), INTERVAL 1 MONTH) <= p.submitdate')); $total = count($flights); and <?php $hours = PIREPData::getIntervalDataByMonth(array(), 1); echo $hours->total; ?> I added those code in Pilot center , but doesn't work . and no value show in pilot center . Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted March 20, 2010 Administrators Report Share Posted March 20, 2010 If you add a DB::debug() after them, like: DB::debug(); What does that show? 1 Quote Link to comment Share on other sites More sharing options...
faraz Posted March 20, 2010 Author Report Share Posted March 20, 2010 HI <?php $flights = PIREPData::findPIREPS(array('DATE_SUB(CURDATE(), INTERVAL 1 MONTH) <= p.submitdate')); $total = count($flights); echo $total; ?> that code for Flight This Month work , now show all pireps, but i want show Flight This Month for accepted pireps . and for Hours This Month : <?php $hours = PIREPData::getIntervalDataByMonth(array(), 1); echo $hours->total; DB::debug(); ?> doesn't work . and how can I use those codes in Pilot center and pilot public profile ? Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted March 20, 2010 Administrators Report Share Posted March 20, 2010 HI <?php $flights = PIREPData::findPIREPS(array('DATE_SUB(CURDATE(), INTERVAL 1 MONTH) <= p.submitdate')); $total = count($flights); echo $total; ?> This code for Flight This Month work , But i want show Flight This Month for accepted pireps , now show all pireps . and for Hours This Month : <?php $hours = PIREPData::getIntervalDataByMonth(array(), 1); echo $hours->total; DB::debug(); ?> doesn't work . It'll show some debug output on the screen. What is that? Quote Link to comment Share on other sites More sharing options...
faraz Posted March 20, 2010 Author Report Share Posted March 20, 2010 for second code nothing show on screen , but first code fully work . Quote Link to comment Share on other sites More sharing options...
faraz Posted March 22, 2010 Author Report Share Posted March 22, 2010 can anybody help me! Hours This Month doesn't work . how can i use those codes in pilot center and pilot public profile . Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted March 22, 2010 Administrators Report Share Posted March 22, 2010 After $flights = PIREPData::findPIREPS(array('DATE_SUB(CURDATE(), INTERVAL 1 MONTH) <= p.submitdate')); DB::debug(); Add that DB::debug(); What does the output say? Quote Link to comment Share on other sites More sharing options...
faraz Posted March 22, 2010 Author Report Share Posted March 22, 2010 $hours = PIREPData::getIntervalDataByMonth(array(), 1); echo $hours->total; DB::debug(); ?> that code is correct ? if correct , Not shown anything . Flight Hours this Month: Quote Link to comment Share on other sites More sharing options...
faraz Posted March 25, 2010 Author Report Share Posted March 25, 2010 Hours This Month: ezDB (v3.00) Debug.. Query [10] -- [sELECT DATE_FORMAT(p.submitdate, '%Y-%m') AS ym, UNIX_TIMESTAMP(p.submitdate) AS timestamp, COUNT(p.pirepid) AS total, SUM(p.revenue) as revenue, SUM(p.gross) as gross, SUM(p.fuelprice) as fuelprice, SUM(p.price) as price, SUM(p.expenses) as expenses, (SUM(p.pilotpay) * SUM(p.flighttime)) as pilotpay FROM phpvms_pireps p WHERE DATE_SUB(NOW(), INTERVAL 1 MONTH) <= p.submitdate GROUP BY `ym` ORDER BY `timestamp` ASC] Query Result.. (row) string 0 ym int 0 timestamp int 0 total real 0 revenue real 0 gross real 0 fuelprice real 0 price real 0 expenses real 0 pilotpay No Results Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted March 26, 2010 Administrators Report Share Posted March 26, 2010 So that says there were no PIREPs since it returns empty Quote Link to comment Share on other sites More sharing options...
faraz Posted March 26, 2010 Author Report Share Posted March 26, 2010 Flight Hours This Month: <?php $hours = PIREPData::getIntervalDataByMonth(array(), 1); echo $hours->total; DB::debug(); ?> ezDB (v3.00) Debug.. Query [12] -- [sELECT * FROM phpvms_expenselog WHERE `dateadded`=201003] Query Result.. (row) int 0 dateadded string 0 name string 0 type real 0 cost No Results I have 6 PIREPs for this Month . Flight This Month: 6 Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted March 26, 2010 Administrators Report Share Posted March 26, 2010 I'll look Quote Link to comment Share on other sites More sharing options...
faraz Posted April 2, 2010 Author Report Share Posted April 2, 2010 Hi Nabeel Did you find any solution for Flight Hours This Month ? Quote Link to comment Share on other sites More sharing options...
faraz Posted April 2, 2010 Author Report Share Posted April 2, 2010 please check this code . $pireps = PIREPData::findPIREPS(array('DATE_SUB(CURDATE(), INTERVAL 1 MONTH) <= p.submitdate')); $thismonth = 0; foreach($pireps as $pirep) { $thismonth = $pirep->flighttime; } echo $thismonth; 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.