This is my first attempt to write a file. I have what I think should work but it does not.
[php]
$sql="SELECT OrbeData_KithKitchens.dbo.WIP_master.uompschedulenumber, case
when OrbeData_KithKitchens.dbo.WIP_master.uompscheduleColor=‘SHORT’ Then ‘White’ else OrbeData_KithKitchens.dbo.WIP_master.uompscheduleColor
end as uompscheduleColor,jmaPartID,OrbeData_KithKitchens.dbo.WIP_master.ompSalesOrderID, uomlSorP,serial,rail,panel,stile,upsdescription,itemtype,jmaPartShortDescription
, uomlStyleGroup,status ,convert(varchar(19),createdate,0) as createdate ,convert(varchar(19),lastupdate,0) as lastupdate ,
Case
when status=10 then ‘Created’
when status=3 then ‘PreSanding’
when status=4 then ‘PrePaint’
when status=5 then ‘Paint’
when status=6 then ‘PostPaint’ else
‘’ end as Status1, m1_DC.dbo.SalesOrders.UOMPTRUCKNUMBER
FROM WIP_master
left join m1_DC.dbo.SalesOrders on m1_DC.dbo.SalesOrders.ompSalesOrderID=OrbeData_KithKitchens.dbo.WIP_master.ompSalesOrderID
where OrbeData_KithKitchens.dbo.WIP_master.serial=’$serial’
order by OrbeData_KithKitchens.dbo.WIP_master.uompschedulenumber,uomlSorP,upsdescription,jmaPartID ";
$result =odbc_exec($connect,$sql);
if(!$result){
exit(“Error in SQL”);
}
while (odbc_fetch_row($result)) {
$bgcolor= odbc_result($result, “uompscheduleColor”);
$jmaPartID= odbc_result($result, “jmaPartID”);
$ompSalesOrderID= odbc_result($result, “ompSalesOrderID”);
$uomlSorP= odbc_result($result, “uomlSorP”);
$serial= odbc_result($result, “serial”);
$upsdescription= odbc_result($result, “upsdescription”);
$itemtype = odbc_result($result, “itemtype”);
$jmaPartShortDescription = odbc_result($result, “jmaPartShortDescription”);
$status1 = odbc_result($result, “status1”);
$createdate=odbc_result($result, “createdate”);
$lastupdate=odbc_result($result, “lastupdate”);
$uompschedulenumber=odbc_result($result, “uompschedulenumber”);
$truck=odbc_result($result, “UOMPTRUCKNUMBER”);
}
$file= fopen(“test.txt”,“w”);
fwrite ($file,"$jmaPartID;$ompSalesOrderID;$uomlSorP;$serial;$upsdescription;$itemtype;$jmaPartShortDescription;$status1;$createdate;$lastupdate;$uompschedulenumber;$truck;");
fclose($file);
odbc_close($connect);
?>