Alright, I have no problem outputting multiple lines of data out of the database, I just have no idea how to get it out in the format I want.
Here’s my basic issue.
<tr>
<?php
//make connection to database, bail if no connection
$connection = odbc_pconnect('sitedata','','');
if (!$connection) { exit("Connection Failed: " . $connection); }
//retrieve relevant data
$Date = "SELECT EntryDate AS DT FROM TimeSheet WHERE EmployeeID = 'AA01'";
$rs = odbc_exec($connection, $Date);
//output data
while(odbc_fetch_row($rs)) {
$Line1 = odbc_result($rs, 'DT');
printf("<td><center>%s</center></td>", $Line1);
}
?>
</tr>
What this will do is output a one row table, with each new date creating a new column.
Now then, this is sort of useless to me as these need to be output into a single column, where each new datavalue is the beginning of a row. After this, I need to expand the table width wise, adding new data values such as:
$Time = "SELECT TotalTime as EN FROM TimeSheet WHERE EmployeeID = 'AA01'";
$JobName = "SELECT JobName as JN FROM TimeSheet WHERE EmployeeID = 'AA01'";
Where Time is it’s own column, JobName is it’s own column, etc.
How exactly do I do this? There obviously must be a way, I’m just new at this. Any help is greatly, greatly appreciated!
You need to get the fields in one SQL statement…
With that you can do exactly what you are doing now except build a full row instead of columns.