Need help

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

For the fleet page I use this: , 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.

For the fleet page I use this: , 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?

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.

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 :slight_smile:

That sql code, can it be put into a class file? Or should it just be labeled whatever.class.php or .tpl?