I am very close to finishing my website which utilises PHP coupled with a MySQL database. However, I am at the stage where I only have a few very difficuly (in my opinion) things left to do.
I think I'll just ask the questions then post the code if it is needed.
- I have a member list, the details are taken from the member's table with a simple query. This works fine, however, I wish to add times from another table and put them into this member list as a total time.
Query that gets the simple information, name, id etc
Code:
// Request details of pilots
$result = mysql_query("SELECT pid, first_name, last_name, vatsimid FROM roster");
if (!$result) {
echo("<P>Error performing query: " . mysql_error() . "</P>");
exit(); }
Query that gets the times from the other table, subtracts them from each other to get total time, and only gets those times related to each member seperately:
Code:
// Select all the pireps the pilot has filed and add up the hours
$sql = mysql_query("SELECT pirep.pid, roster.pid, SUM(pirep.arrtime-pirep.deptime) AS 'time' FROM pirep, roster WHERE pirep.pid = roster.pid GROUP BY pirep.pid");
if (!$sql) {
echo("<P>Error performing query: " . mysql_error() . "</P>");
exit(); }
This doesn't work as it only gets the times for the first member and only displays that one member on the member list.
Page located here:
http://southerncrossairlines.ausvirt...ete/roster.php
2. I have another form where the user types in start and finish times, and I want this to be inserted into the table in a format so I can use the above code to get a correct total time. Is there a way to do this and how?
3. On this same form, users select an id number, I want some text to appear next to this option list displaying the details of that id. How do I do this?
http://southerncrossairlines.ausvirt...lete/pirep.php
That's all the questions I have for now, I'll post again if I think of more.