Jump to content

New Pilot List.


vicente

Recommended Posts

I Did a new pilot list adapted of the FSACARS code.

This code need conect_db.Example

<?php

$hostName = "localhost";
$userName = "XXXXX";
$password = "XXXX";
$dbName = "XXXXX";

/* make connection to database */
mysql_connect($hostName, $userName, $password) or die("Unable to connect to host $hostName");
mysql_select_db($dbName) or die("Unable to select database $dbName");
?>

<?php


/* Constants */
@define ("MYSQL_CONNECT_INCLUDE", "connect_db.php");		// MySQL database connection (a sample file is included)


/* Database connection */
include(MYSQL_CONNECT_INCLUDE);

/* Select all pilots */
$query = "SELECT * FROM phpvms_pilots ORDER BY pilotid ASC";
$result = mysql_query($query);

/* Determine the number of pilots */
$number = mysql_numrows($result);

if ($number > 0) {
/* Print roster header 
   Change this HTML to fit your webpage layout */
print "<table>";
print "<tr>";
print "<td bgcolor=#FF0000 width=73 height=12 align=left><font face=Arial color=#FFFFFF size=1><b>Primeiro Nome</b></font></td>";
print "<td bgcolor=#FF0000 width=73 height=12 align=left><font face=Arial color=#FFFFFF size=1><b>Ultimo Nome</b></font></td>";
print "<td bgcolor=#FF0000 width=73 height=12 align=left><font face=Arial color=#FFFFFF size=1><b>País</b></font></td>";
print "<td bgcolor=#FF0000 width=73 height=12 align=left><font face=Arial color=#FFFFFF size=1><b>Tempo de Voo</b></font></td>";
print "<td bgcolor=#FF0000 width=73 height=12 align=left><font face=Arial color=#FFFFFF size=1><b>Hub</b></font></td>";
print "<td bgcolor=#FF0000 width=73 height=12 align=left><font face=Arial color=#FFFFFF size=1><b>Total de Voos</b></font></td>";
print "<td bgcolor=#FF0000 width=73 height=12 align=left><font face=Arial color=#FFFFFF size=1><b>Data de Ingresso</b></font></td>";
print "</tr>";

/* Get pilots info */
for ($i=0; $i<$number; $i++) {
     		$totalflights = mysql_result($result,$i,"totalflights");
     		$firstname= mysql_result($result,$i, "firstname");
     		$lastname= mysql_result($result,$i, "lastname");
     		$location = mysql_result($result,$i, "location");
     		$totalhours = mysql_result($result,$i, "totalhours");
     		$joindate = mysql_result($result,$i, "joindate");
     		$hub = mysql_result($result,$i, "hub");
	$id = mysql_result($result,$i, "pilotid");

         	
     		/* Display roster entries */
     		print "<tr>";
     		print "<td width=73 height=12 align=left><font face=Arial size=1 color=#000000>$firstname</font></td>";
     		print "<td width=73 height=12 align=left><font face=Arial size=1 color=#000000>$lastname</font></td>";
     		print "<td width=73 height=12 align=left><font face=Arial size=1 color=#000000>$location</font></td>";
     		print "<td width=73 height=12 align=left><font face=Arial size=1 color=#000000>$totalhours</font></td>";
     		print "<td width=73 height=12 align=left><font face=Arial size=1 color=#000000>$hub</font></td>";
     		print "<td width=73 height=12 align=left><font face=Arial size=1 color=#000000>$totalflights</font></td>";
     		print "<td width=73 height=12 align=left><font face=Arial size=1 color=#000000>$joindate</font></td>";
     		print "</tr>";
}

print "</table>";
}

/* Print table footer */
print "<table>";
print "<tr><td><font face=Arial size=1 color=gray>Powered by Joaquim Vicente Felicio Alberico - http://www.voetamvirtual.net</font></td></tr>";
print "</table>";

/* Close the database connection */
mysql_close();
?>

If someone need some help call me.

If someone want's to see the pilot list you can see hear http://voetamvirtual.net/virtualairline/index.php/Pages/listadepilotos.

Link to comment
Share on other sites

  • Administrators

You don't need to do all that.

Just call:

include '/path/to/core/codon.config.php';
$allpilots = PilotData::GetAllPilots();

foreach($allpilots as $pilot)
{
   // do stuff
}

Assuming you're not creating a module. Watch the API tutorial video too :)

Link to comment
Share on other sites

  • 1 year later...

Can I ask what document the second slab of code came from in the first post in this topic? I need it to change the pilot_list ORDER BY function, and I can't remember which file it was.

Many thanks

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...