vicente Posted December 5, 2009 Report Share Posted December 5, 2009 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. Quote Link to comment Share on other sites More sharing options...
hjhjhgjgjh Posted December 5, 2009 Report Share Posted December 5, 2009 "Not Allowed You are not allowed permission to access this page" maybe you could upload a screenshot Quote Link to comment Share on other sites More sharing options...
vicente Posted December 5, 2009 Author Report Share Posted December 5, 2009 Sorry the link of the table hear. http://voetamvirtual.net/pilot_roster.php Quote Link to comment Share on other sites More sharing options...
hjhjhgjgjh Posted December 5, 2009 Report Share Posted December 5, 2009 hmm may i ask what is the difference between your pilot list and the one which is already build in? Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted December 5, 2009 Administrators Report Share Posted December 5, 2009 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 Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted December 5, 2009 Administrators Report Share Posted December 5, 2009 ^do stuff! - lmao - dont know why but that made me laugh today! ;D Quote Link to comment Share on other sites More sharing options...
Guest Posted June 6, 2011 Report Share Posted June 6, 2011 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 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.