Files
controls-web/OLD/controlsdev/data/sugartot.php
2026-02-17 09:29:34 -06:00

36 lines
856 B
PHP

<?php
$serverName = "OPTIMUS\SQLEXPRESS";
$uid = "crw";
$pwd = "rp02751";
$connectionInfo = array( "UID"=>$uid, "PWD"=>$pwd,'ReturnDatesAsStrings'=> true, "CharacterSet" => 'utf-8', "Database"=>"Lasuca_MillData" );
/* 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 SUM(GrossWeight) - SUM(TareWeight) AS Tons FROM MaterialInfo WHERE TruckNumber LIKE '%Lasuca1%' OR TruckNumber LIKE '%Lasuca2%'";
$stmt = sqlsrv_query( $conn, $sql );
if( $stmt === false) {
die( print_r( sqlsrv_errors(), true) );
}
$tonsin = 0;
while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) )
{
$tonsin += $row['Tons'];
}
//end
?>
<?php echo $tonsin; ?>
<?
$db = null;
?>