54 lines
1.7 KiB
PHP
54 lines
1.7 KiB
PHP
<?php
|
|
|
|
$serverName = "CBM2K12\SQLEXPRESS";
|
|
$uid = "cbmclient";
|
|
$pwd = "ascbm2k";
|
|
$connectionInfo = array( "UID"=>$uid, "PWD"=>$pwd,'ReturnDatesAsStrings'=> true, "CharacterSet" => 'utf-8', "Database"=>"SugarCaneScale" );
|
|
|
|
/* Connect using SQL Server Authentication. */
|
|
$conn = sqlsrv_connect( $serverName, $connectionInfo);
|
|
if( $conn === false )
|
|
{
|
|
echo "Unable to connect.</br>";
|
|
die( print_r( sqlsrv_errors(), true));
|
|
}
|
|
|
|
$sql = "SELECT VehicleId_Fk, LoadId_Pk, CropDay, TractId_Fk, TareWt, GrossWt, Tons, FarmerId_Fk, CONVERT(varchar, DateOut, 100) [TIME], SplitPercent, Parked
|
|
FROM LoadData
|
|
WHERE VehicleId_Fk
|
|
LIKE 'V99%'
|
|
ORDER by LoadId_Pk DESC";
|
|
|
|
$stmt = sqlsrv_query( $conn, $sql );
|
|
if( $stmt === false) {
|
|
die( print_r( sqlsrv_errors(), true) );
|
|
}
|
|
?>
|
|
<table width="100%">
|
|
<thead>
|
|
<tr>
|
|
<th>Load No</th>
|
|
<th>Vehicle</th>
|
|
<th>Tract</th>
|
|
<th>Tons</th>
|
|
<th>Tare</th>
|
|
<th>Gross</th>
|
|
<th>Time Out</th>
|
|
</tr>
|
|
</thead>
|
|
<?php
|
|
while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) ) {
|
|
echo "<tr>";
|
|
echo"<td>".$row['LoadId_Pk']."</td>";
|
|
echo"<td>".$row['VehicleId_Fk']."</td>";
|
|
echo"<td>".$row['TractId_Fk']."</td>";
|
|
echo"<td>".$row['Tons']."</td>";
|
|
echo"<td>".$row['TareWt']."</td> ";
|
|
echo"<td>".$row['GrossWt']."</td> ";
|
|
echo "</tr>";
|
|
}
|
|
/* Free statement and connection resources. */
|
|
sqlsrv_free_stmt( $stmt);
|
|
sqlsrv_close( $conn);
|
|
?>
|
|
</table>
|