BBuchanan Posted April 23, 2011 Report Share Posted April 23, 2011 I'm not one to do scripting, so if I could get some help, would be great. I'll ask questions regarding what I'm doing in this post. First off, how is a module created that shows up in the admin area as well as frontpage? Next, how can I show only 1 of each of the aicraft in the fleet on a page? edit: All this is going to be in the same module Quote Link to comment Share on other sites More sharing options...
Tom Posted April 23, 2011 Report Share Posted April 23, 2011 For the fleet page I use this: http://forum.phpvms.net/topic/1522-fleet-table/ , with a query like this: $sql = 'SELECT a.*, a.name AS aircraft, COUNT(p.pirepid) AS routesflown, SUM(p.distance) AS distance, SEC_TO_TIME(SUM(p.flighttime*60*60)) AS totaltime, AVG(p.distance) AS averagedistance, AVG(p.flighttime) as averagetime FROM '.TABLE_PREFIX.'aircraft a LEFT OUTER JOIN '.TABLE_PREFIX.'pireps p ON (p.aircraft = a.id) GROUP BY a.icao ORDER BY a.registration'; in the php page. Modules are either on the admin panel or pilot/public side, not both at the same time. You will need to create a separate module for the admin panel. Quote Link to comment Share on other sites More sharing options...
BBuchanan Posted April 23, 2011 Author Report Share Posted April 23, 2011 For the fleet page I use this: http://forum.phpvms.net/topic/1522-fleet-table/ , with a query like this: $sql = 'SELECT a.*, a.name AS aircraft, COUNT(p.pirepid) AS routesflown, SUM(p.distance) AS distance, SEC_TO_TIME(SUM(p.flighttime*60*60)) AS totaltime, AVG(p.distance) AS averagedistance, AVG(p.flighttime) as averagetime FROM '.TABLE_PREFIX.'aircraft a LEFT OUTER JOIN '.TABLE_PREFIX.'pireps p ON (p.aircraft = a.id) GROUP BY a.icao ORDER BY a.registration'; in the php page. Modules are either on the admin panel or pilot/public side, not both at the same time. You will need to create a separate module for the admin panel. Ok, is the .tpl files the seperation? Edit: Is there a class or function that's cleaner than pulling direct sql? Quote Link to comment Share on other sites More sharing options...
Tom Posted April 23, 2011 Report Share Posted April 23, 2011 Ok, is the .tpl files the seperation? Edit: Is there a class or function that's cleaner than pulling direct sql? the fleet page I use this: http://forum.phpvms....22-fleet-table/ Download that and you'll see why I pasted what I pasted. Quote Link to comment Share on other sites More sharing options...
BBuchanan Posted April 24, 2011 Author Report Share Posted April 24, 2011 Download that and you'll see why I pasted what I pasted. Ok, I see why you had me look at that. And I appreciate the help that I'm getting :-) That sql code, can it be put into a class file? Or should it just be labeled whatever.class.php or .tpl? 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.