Ok, I really don't understand the workings of phpvms to try and do my own modules. So, I am asking for some guidance on one of my old sites stats pages.....
Here is my original code of an html page. It basically showed the amount of hours pilots had per aircraft. I am hoping someone can sort of guide me in how/what I could do to make this function in phpvms.
I used to pull all the data from the sql database, and obviously, you can tell I was doing it the long/hard way.
I think I get confused by how to grab the data, how to add the data together from different tables, etc. inside the phpvms environment. I would really like to understand phpvms so I can help, rather than asking questions all the time and feeling stupid
<body>
<?
print "<center>";
print "<b><font size=+3 color=#D86C4D>$callsign Fleet Stats</font></b><br>";
print "<hr width=800 align=center>";
$conn = mysql_connect( "canadianclassicairlines.com", "******", "******" );
mysql_select_db( "******_pireps" );
$query = "SELECT callsign, equipment, ROUND((SUM(time_to_sec(duration))/3600),2) AS block, COUNT(duration) AS flights FROM reports WHERE callsign = '$callsign' GROUP BY equipment";
$result = mysql_query($query) or die(mysql_error());
echo "<table border='1'>";
echo "<tr> <th>Aircraft</th> <th>Flights</th> <th>Hours</th> <th>Certified</th></tr>";
while($row = mysql_fetch_array($result)){
echo "<tr><td align=left>";
echo $row['equipment'];
echo "</td><td align=center>";
echo $row['flights'];
echo "</td><td align=center>";
echo $row['block'];
echo "</td><td align=center>";
$var1 = '<img src="../pics/misc/orangerank.gif">';
if($row['block']>9.9 && $row['equipment']=='DC3'){
echo $var1;
}if($row['block']>9.9 && $row['equipment']=='DC6'){
echo $var1;
}if($row['block']>99.9 && $row['equipment']=='B737-200'){
echo $var1;
}if($row['block']>124.9 && $row['equipment']=='B727-100'){
echo $var1;
}if($row['block']>124.9 && $row['equipment']=='B727-200'){
echo $var1;
}if($row['block']>159.9 && $row['equipment']=='DC8-43'){
echo $var1;
}if($row['block']>159.9 && $row['equipment']=='DC8-53'){
echo $var1;
}if($row['block']>159.9 && $row['equipment']=='DC8-55'){
echo $var1;
}if($row['block']>199.9 && $row['equipment']=='DC8-63'){
echo $var1;
}if($row['block']>274.9 && $row['equipment']=='DC10-10'){
echo $var1;
}if($row['block']>299.9 && $row['equipment']=='DC10-30'){
echo $var1;
}if($row['block']>499.9 && $row['equipment']=='B747-200'){
echo $var1;
}if($row['block']>39.9 && $row['equipment']=='ATR72-500'){
echo $var1;
}if($row['block']>59.9 && $row['equipment']=='CRJ-200'){
echo $var1;
}if($row['block']>74.9 && $row['equipment']=='BAe146-200'){
echo $var1;
}if($row['block']>124.9 && $row['equipment']=='B737-300'){
echo $var1;
}if($row['block']>124.9 && $row['equipment']=='B737-700'){
echo $var1;
}if($row['block']>149.9 && $row['equipment']=='B757-200'){
echo $var1;
}if($row['block']>299.9 && $row['equipment']=='B767-300'){
echo $var1;
}if($row['block']>399.9 && $row['equipment']=='MD11'){
echo $var1;
}if($row['block']>499.9 && $row['equipment']=='B747-400'){
echo $var1;
}
echo "</td></tr>";
}
echo "</table>";
?>
<?
print "<center>";
print "<b><font size=+3 color=#D86C4D>$callsign Flights</font></b><br>";
print "<hr width=908 align=center>";
$query = "SELECT * FROM reports WHERE callsign = '$callsign' ORDER BY date, report_id";
$result = mysql_query($query) or die(mysql_error());
echo "<table border='1'>";
echo "<tr> <th><font color=#D86C4D>Date of Flight</font></th> <th><font color=#D86C4D>Dep Airport</font></th> <th><font color=#D86C4D>Arr Airport</font></th> <th><font color=#D86C4D>Aircraft Reg</font></th> <th><font color=#D86C4D>Aircraft Type</font></th> <th><font color=#D86C4D>Block Time</font></th> <th><font color=#D86C4D>Fuel</font></th> <th><font color=#D86C4D>Distance</font></th> </tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo "<tr><td>";
echo $row['date'];
echo "</td><td>";
echo $row['origin_id'];
echo "</td><td>";
echo $row['destination_id'];
echo "</td><td>";
echo $row['registration'];
echo "</td><td>";
echo $row['equipment'];
echo "</td><td>";
echo $row['duration'];
echo "</td><td>";
echo $row['fuel'];
echo "</td><td>";
echo $row['distance'];
echo "</td></tr>";
}
echo "</table>";
?>
</p>
<p align="center" class="style17"> </p> </td>
</tr>
<tr>
<td bgcolor="#C6C6C6"> </td>
<td colspan="2" bgcolor="#C6C6C6"> </td>
</tr>
<tr>
<td colspan="3" bgcolor="#C6C6C6"> </td>
</tr>
</table>
</body>
</html>