PHP MySQL Query, then add data then write to csv

swedesamurai
swedesamurai used Ask the Experts™
on
Hello Experts,
Being simple minded, I am having trouble with this:  I want to do a query of a table say the table has Field01, Field02, Field03,....Field25.  I have to export this data to a CSV file that will be imported into a AS/400, but because the AS/400 uses proprietory software, where the fiields for import are predefined, I have to adjust my server data to conform to the AS400 Structure.  This means for each record I must add or insert fields prior to exporting to a CSV file.  I can do the query no problem, I can create fields no problem but how do I order the fields the way I want them per row, and then write it to a csv file.  Oh did I say that I have to also add data fields for each row.  I can guess that this requires a function that includes a query per row based upon a selection and then adding the new fields, end the row and the function, write the row and go on to the next row.  Is this right?  
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2011
Top Expert 2016

Commented:
Seems like this line of inquiry should be broken down into more than one question - I am not sure where to start, so I will try to answer this question:

"how do I order the fields the way I want them per row, and then write it to a csv file"

You can order the fields via the SELECT query.  Consider this:

SELECT name, address, phone FROM table

Now consider this:

SELECT phone, name, address FROM table

In those two examples, the results set will have the columns in different order.  You can also explicitly take data from each row and construct the CSV string in any order you want.

You can use this function to produce a CSV:
http://us.php.net/manual/en/function.fputcsv.php

In combination it might look something like the code snippet (however I have not tested this).

Hope that helps, ~Ray
// CREATING AND SENDING A SELECT QUERY AND TESTING THE RESULTS
// MAN PAGE:http://us2.php.net/manual/en/function.mysql-query.php
$sql = "SELECT name, addr, phone FROM my_table";
$res = mysql_query($sql);
 
// IF mysql_query() RETURNS FALSE, GET THE ERROR REASONS
if (!$res)
{
   $errmsg = mysql_errno() . ' ' . mysql_error();
   echo "<br/>QUERY FAIL: ";
   echo "<br/>$sql <br/>";
   die($errmsg);
}
// IF WE GET THIS FAR, THE QUERY SUCCEEDED AND WE HAVE A RESOURCE-ID IN $res SO WE CAN NOW USE $res IN OTHER MYSQL FUNCTIONS
 
 
// OPEN THE OUTPUT FILE
$fp = fopen('file.csv', 'w');
 
 
// ITERATE OVER THE QUERY RESULTS SET
// MAN PAGE: http://us2.php.net/manual/en/function.mysql-fetch-array.php
while ($row = mysql_fetch_array($res))
{
   fputcsv($fp, $row); // MAN PAGE http://us.php.net/manual/en/function.fputcsv.php
}
 
// ALL DONE
fclose($fp);

Open in new window

Most Valuable Expert 2011
Top Expert 2016

Commented:
After some follow-on experimentation, please change line 23 in the example above to use a different MySQL-related function.
// LINE 23 WORKS BETTER THIS WAY
while ($row = mysql_fetch_row($res))

Open in new window

Author

Commented:
OK I got the structure but the question is can I modify the records in $res before they are written into the csv file?
example if field 1 = 4 then place a x in a new field to be added to the interation before it is written to the csv?
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

Most Valuable Expert 2011
Top Expert 2016

Commented:
"can I modify the records" - Of course.  Just place your code to do this inside the "while" loop, before the "fputcsv()" statement at line 25.  Each row of the data base is presented to you in the array named $row, and you can modify the elements of that array in any way you want.

Best regards, ~Ray

Author

Commented:
Hello Ray,
I really did try to do this myself.  That's why I was so quiet fo so long. To test the changes per interation I used a standard query to call one row I wanted it to add fields based upon the content of the fields for export.  Because of the size of the AS/400 file in fields per row about 470, I need to add the extra fields for every row interation.  I'll provide the code below it is long an bloated know but normally stuff like this works for me. (That's my level of efficency or inefficenca..whatever)  The problem I am having since the code and the fields are so long is that I have several external php files with long if else chains in them.  Unfortunately it does not work.  I don't know if it lies on in the placement in the interation or in the external files.  These are rather long so I have shorten them.
// Connect to host
$db_host = "localhost";
// Place the username for the MySQL database here
$db_username = "test"; 
// Place the password for the MySQL database here
$db_pass = "tester"; 
// Place the name for the MySQL database here
$db_name = "ema888";
 
// Run the connection here 
@mysql_connect("$db_host","$db_username","$db_pass") or die ("could not connect to mysql");
@mysql_select_db("$db_name") or die ("no database");
 
// Query member data from the database and ready it for display
$sql = mysql_query("SELECT * FROM engplay WHERE SCZDRNO1='$sczdrno1'"); 
while($row = mysql_fetch_array($sql)){ 
$KDNKDNR=$row['KDNKDNR'];
$KDNBESTN=$row['KDNBESTN'];
$KDNVTRN=$row['KDNVTRN'];
$KDNVMN=$row['KDNVMN'];
$TRANSDAT=$row['TRANSDAT'];
$IPNR=$row['IPNR'];
$SCZAPD=$row['SCZAPD'];
$SCZZRT=$row['SCZZRT'];
$SCZNRSC=$row['SCZNRSC'];
$SCZODA4=$row['SCZODA4'];
$SCZDTGA4=$row['SCZDTGA4'];
$SCZDTGB4=$row['SCZDTGB4'];
$SCZDTD14=$row['SCZDTD14'];
$SCZDTD24=$row['SCZDTD24'];
$SCZDTD34=$row['SCZDTD34'];
$SCZDTD44=$row['SCZDTD44'];
$SCZDTD54=$row['SCZDTD54'];
$SCZNRZ1=$row['SCZNRZ1'];
$SCZN1R1=$row['SCZN1R1'];
$SCZN2R1=$row['SCZN2R1'];
$SCZN3R1=$row['SCZN3R1'];
$SCZN4R1=$row['SCZN4R1'];
$SCZN5R1=$row['SCZN5R1'];
$SCZS1R1=$row['SCZS1R1'];
$SCZS2R1=$row['SCZS2R1'];
$SCZPE01=$row['SCZPE01'];
$SCZGW01=$row['SCZGW01'];
$SCZNRZ2=$row['SCZNRZ2'];
$SCZN1R2=$row['SCZN1R2'];
$SCZN2R2=$row['SCZN2R2'];
$SCZN3R2=$row['SCZN3R2'];
$SCZN4R2=$row['SCZN4R2'];
$SCZN5R2=$row['SCZN5R2'];
$SCZS1R2=$row['SCZS1R2'];
$SCZS2R2=$row['SCZS2R2'];
$SCZPE02=$row['SCZPE02'];
$SCZGW02=$row['SCZGW02'];
$SCZNRZ3=$row['SCZNRZ3'];
$SCZN1R3=$row['SCZN1R3'];
$SCZN2R3=$row['SCZN2R3'];
$SCZN3R3=$row['SCZN3R3'];
$SCZN4R3=$row['SCZN4R3'];
$SCZN5R3=$row['SCZN5R3'];
$SCZS1R3=$row['SCZS1R3'];
$SCZS2R3=$row['SCZS2R3'];
$SCZPE03=$row['SCZPE03'];
$SCZGW03=$row['SCZGW03'];
$SCZNRZ4=$row['SCZNRZ4'];
$SCZN1R4=$row['SCZN1R4'];
$SCZN2R4=$row['SCZN2R4'];
$SCZN3R4=$row['SCZN3R4'];
$SCZN4R4=$row['SCZN4R4'];
$SCZN5R4=$row['SCZN5R4'];
$SCZS1R4=$row['SCZS1R4'];
$SCZS2R4=$row['SCZS2R4'];
$SCZPE04=$row['SCZPE04'];
$SCZGW04=$row['SCZGW04'];
$SCZNRZ5=$row['SCZNRZ5'];
$SCZN1R5=$row['SCZN1R5'];
$SCZN2R5=$row['SCZN2R5'];
$SCZN3R5=$row['SCZN3R5'];
$SCZN4R5=$row['SCZN4R5'];
$SCZN5R5=$row['SCZN5R5'];
$SCZS1R5=$row['SCZS1R5'];
$SCZS2R5=$row['SCZS2R5'];
$SCZPE05=$row['SCZPE05'];
$SCZGW05=$row['SCZGW05'];
$SCZNRZ6=$row['SCZNRZ6'];
$SCZN1R6=$row['SCZN1R6'];
$SCZN2R6=$row['SCZN2R6'];
$SCZN3R6=$row['SCZN3R6'];
$SCZN4R6=$row['SCZN4R6'];
$SCZN5R6=$row['SCZN5R6'];
$SCZS1R6=$row['SCZS1R6'];
$SCZS2R6=$row['SCZS2R6'];
$SCZPE06=$row['SCZPE06'];
$SCZGW06=$row['SCZGW06'];
$SCZNRZ7=$row['SCZNRZ7'];
$SCZN1R7=$row['SCZN1R7'];
$SCZN2R7=$row['SCZN2R7'];
$SCZN3R7=$row['SCZN3R7'];
$SCZN4R7=$row['SCZN4R7'];
$SCZN5R7=$row['SCZN5R7'];
$SCZS1R7=$row['SCZS1R7'];
$SCZS2R7=$row['SCZS2R7'];
$SCZPE07=$row['SCZPE07'];
$SCZGW07=$row['SCZGW07'];
$SCZESUM=$row['SCZESUM'];
$SCZTGEW=$row['SCZTGEW'];
$SCZJONN=$row['SCZJONN'];
$SCZJOJ1=$row['SCZJOJ1'];
$SCZJOJ2=$row['SCZJOJ2'];
$SCZJOJ3=$row['SCZJOJ3'];
$SCZJON1=$row['SCZJON1'];
$SCZJON2=$row['SCZJON2'];
$SCZJON3=$row['SCZJON3'];
$SCZJOK1=$row['SCZJOK1'];
$SCZJOK2=$row['SCZJOK2'];
$SCZJOK3=$row['SCZJOK3'];
$SCZJOW1=$row['SCZJOW1'];
$SCZJOW2=$row['SCZJOW2'];
$SCZJOW3=$row['SCZJOW3'];
$SCZABZ1=$row['SCZABZ1'];
$SCZABZ2=$row['SCZABZ2'];
$SCZABZ3=$row['SCZABZ3'];
$SCZABZ4=$row['SCZABZ4'];
$SCZABZ5=$row['SCZABZ5'];
include_once ('ExportRow1xs.php');
}
 
This include_once is nothing more than placing Xs in certain fields when numbers appear.  
i.e.
if 
($SCZN1R1 == "1")
{
$SCZZ011 = "X";
}
else
{
$SCZZ011 = " ";
}
 
 
 
if
($SCZN1R1 == "2")
{
$SCZZ021 = "X";
}
else
{
$SCZZ021 = " ";
}
 
 
 
if
($SCZN1R1 == "3")
{
$SCZZ031 = "X";
}
else
{
$SCZZ031 = " ";
}
 
 
 
if
($SCZN1R1 == "4")
{
$SCZZ041 = "X";
}
else
{
$SCZZ041 = " ";
}
 
 
 
if
($SCZN1R1 == "5")
{
$SCZZ051 = "X";
}
else
{
$SCZZ051 = " ";
}
 
 
 
if
($SCZN1R1 == "6")
{
$SCZZ061 = "X";
}
else
{
$SCZZ061 = " ";
}
 
 
 
if
($SCZN1R1 == "7")
{
$SCZZ071 = "X";
}
else
{
$SCZZ071 = " ";
}
 
 
 
if
($SCZN1R1 == "8")
{
$SCZZ081 = "X";
}
else
{
$SCZZ081 = " ";
}
 
These go on for 50 numbers or so.  <i tried a switch function on them also without good results. What can I be doing wrong?

Open in new window

Most Valuable Expert 2011
Top Expert 2016
Commented:
Well, we got you to where you can produce a CSV file, and showed you where to put your own code to modify the DB output before it becomes part of the CSV file.  I think that's the best i can do for you on this front.  You might want to hire a developer for this task.  It is not really a question, so much as a need for detailed application development and debugging.

Best of luck with it, ~Ray

Author

Commented:
Sorry I meant to hit A but missed.

Author

Commented:
Just to let you know I got it to work like this:
$sczdrno1 = $_POST['sczdrno1'];
 
// Connect to host
$db_host = "localhost";
// Place the username for the MySQL database here
$db_username = "loco"; 
// Place the password for the MySQL database here
$db_pass = "crazy"; 
// Place the name for the MySQL database here
$db_name = "bonkers";
 
 
if
($sczdrno1 != "")
{
$fp = fopen('import.csv', 'w');
// Run the connection here 
@mysql_connect("$db_host","$db_username","$db_pass") or die ("could not connect to mysql");
@mysql_select_db("$db_name") or die ("no database");
 
// Query member data from the database and ready it for display
$sql = "SELECT KDNKDNR,KDNBESTN,MTRNSNR,KDNVTRN,KDNVMN,TRANSDAT,IPNR,SCZAPD,SCZZRT,SCZNRSC,SCZDTGA4,SCZDTGB4,SCZDTD14,SCZDTD24,SCZDTD34,SCZDTD44,SCZDTD54,SCZNRZ1,SCZN1R1,SCZN2R1,SCZN3R1,SCZN4R1,SCZN5R1,SCZS1R1,SCZS2R1,SCZPE01,SCZGW01,SCZNRZ2,SCZN1R2,SCZN2R2,SCZN3R2,SCZN4R2,SCZN5R2,SCZS1R2,SCZS2R2,SCZPE02,SCZGW02,SCZNRZ3,SCZN1R3,SCZN2R3,SCZN3R3,SCZN4R3,SCZN5R3,SCZS1R3,SCZS2R3,SCZPE03,SCZGW03,SCZNRZ4,SCZN1R4,SCZN2R4,SCZN3R4,SCZN4R4,SCZN5R4,SCZS1R4,SCZS2R4,SCZPE04,SCZGW04,SCZNRZ5,SCZN1R5,SCZN2R5,SCZN3R5,SCZN4R5,SCZN5R5,SCZS1R5,SCZS2R5,SCZPE05,SCZGW05,SCZNRZ6,SCZN1R6,SCZN2R6,SCZN3R6,SCZN4R6,SCZN5R6,SCZS1R6,SCZS2R6,SCZPE06,SCZGW06,SCZNRZ7,SCZN1R7,SCZN2R7,SCZN3R7,SCZN4R7,SCZN5R7,SCZS1R7,SCZS2R7,SCZPE07,SCZGW07,SCZESUM,SCZTGEW,SCZJONN,SCZJOJ1,SCZJOJ2,SCZJOJ3,SCZJON1,SCZJON2,SCZJON3,SCZJOK1,SCZJOK2,SCZJOK3,SCZJOW1,SCZJOW2,SCZJOW3,SCZABZ1,SCZABZ2,SCZABZ3,SCZABZ4,SCZABZ5 FROM engplay WHERE SCZDRNO1='$sczdrno1'";
$res = mysql_query($sql);
 
 
// IF mysql_query() RETURNS FALSE, GET THE ERROR REASONS
if (!$res)
{
   $errmsg = mysql_errno() . ' ' . mysql_error();
   echo "<br/>QUERY FAIL: ";
   echo "<br/>$sql <br/>";
   die($errmsg);
}
// IF WE GET THIS FAR, THE QUERY SUCCEEDED AND WE HAVE A RESOURCE-ID IN $res SO WE CAN NOW USE $res IN OTHER MYSQL FUNCTIONS
 
 
// OPEN THE OUTPUT FILE
$fp = fopen('import.csv', 'w');
 
 
// ITERATE OVER THE QUERY RESULTS SET
// MAN PAGE: http://us2.php.net/manual/en/function.mysql-fetch-array.php
while ($row = mysql_fetch_array($res))
 
{
$KDNKDNR=$row['KDNKDNR'];
$KDNBESTN=$row['KDNBESTN'];
$KDNVTRN=$row['KDNVTRN'];
$KDNVMN=$row['KDNVMN'];
$TRANSDAT=$row['TRANSDAT'];
$IPNR=$row['IPNR'];
$SCZAPD=$row['SCZAPD'];
$SCZZRT=$row['SCZZRT'];
$SCZNRSC=$row['SCZNRSC'];
$SCZODA4=$row['SCZODA4'];
$SCZDTGA4=$row['SCZDTGA4'];
$SCZDTGB4=$row['SCZDTGB4'];
$SCZDTD14=$row['SCZDTD14'];
$SCZDTD24=$row['SCZDTD24'];
$SCZDTD34=$row['SCZDTD34'];
$SCZDTD44=$row['SCZDTD44'];
$SCZDTD54=$row['SCZDTD54'];
$SCZNRZ1=$row['SCZNRZ1'];
$SCZN1R1=$row['SCZN1R1'];
$SCZN2R1=$row['SCZN2R1'];
$SCZN3R1=$row['SCZN3R1'];
$SCZN4R1=$row['SCZN4R1'];
$SCZN5R1=$row['SCZN5R1'];
$SCZS1R1=$row['SCZS1R1'];
$SCZS2R1=$row['SCZS2R1'];
$SCZPE01=$row['SCZPE01'];
$SCZGW01=$row['SCZGW01'];
$SCZNRZ2=$row['SCZNRZ2'];
$SCZN1R2=$row['SCZN1R2'];
$SCZN2R2=$row['SCZN2R2'];
$SCZN3R2=$row['SCZN3R2'];
$SCZN4R2=$row['SCZN4R2'];
$SCZN5R2=$row['SCZN5R2'];
$SCZS1R2=$row['SCZS1R2'];
$SCZS2R2=$row['SCZS2R2'];
$SCZPE02=$row['SCZPE02'];
$SCZGW02=$row['SCZGW02'];
$SCZNRZ3=$row['SCZNRZ3'];
$SCZN1R3=$row['SCZN1R3'];
$SCZN2R3=$row['SCZN2R3'];
$SCZN3R3=$row['SCZN3R3'];
$SCZN4R3=$row['SCZN4R3'];
$SCZN5R3=$row['SCZN5R3'];
$SCZS1R3=$row['SCZS1R3'];
$SCZS2R3=$row['SCZS2R3'];
$SCZPE03=$row['SCZPE03'];
$SCZGW03=$row['SCZGW03'];
$SCZNRZ4=$row['SCZNRZ4'];
$SCZN1R4=$row['SCZN1R4'];
$SCZN2R4=$row['SCZN2R4'];
$SCZN3R4=$row['SCZN3R4'];
$SCZN4R4=$row['SCZN4R4'];
$SCZN5R4=$row['SCZN5R4'];
$SCZS1R4=$row['SCZS1R4'];
$SCZS2R4=$row['SCZS2R4'];
$SCZPE04=$row['SCZPE04'];
$SCZGW04=$row['SCZGW04'];
$SCZNRZ5=$row['SCZNRZ5'];
$SCZN1R5=$row['SCZN1R5'];
$SCZN2R5=$row['SCZN2R5'];
$SCZN3R5=$row['SCZN3R5'];
$SCZN4R5=$row['SCZN4R5'];
$SCZN5R5=$row['SCZN5R5'];
$SCZS1R5=$row['SCZS1R5'];
$SCZS2R5=$row['SCZS2R5'];
$SCZPE05=$row['SCZPE05'];
$SCZGW05=$row['SCZGW05'];
$SCZNRZ6=$row['SCZNRZ6'];
$SCZN1R6=$row['SCZN1R6'];
$SCZN2R6=$row['SCZN2R6'];
$SCZN3R6=$row['SCZN3R6'];
$SCZN4R6=$row['SCZN4R6'];
$SCZN5R6=$row['SCZN5R6'];
$SCZS1R6=$row['SCZS1R6'];
$SCZS2R6=$row['SCZS2R6'];
$SCZPE06=$row['SCZPE06'];
$SCZGW06=$row['SCZGW06'];
$SCZNRZ7=$row['SCZNRZ7'];
$SCZN1R7=$row['SCZN1R7'];
$SCZN2R7=$row['SCZN2R7'];
$SCZN3R7=$row['SCZN3R7'];
$SCZN4R7=$row['SCZN4R7'];
$SCZN5R7=$row['SCZN5R7'];
$SCZS1R7=$row['SCZS1R7'];
$SCZS2R7=$row['SCZS2R7'];
$SCZPE07=$row['SCZPE07'];
$SCZGW07=$row['SCZGW07'];
$SCZESUM=$row['SCZESUM'];
$SCZTGEW=$row['SCZTGEW'];
$SCZJONN=$row['SCZJONN'];
$SCZJOJ1=$row['SCZJOJ1'];
$SCZJOJ2=$row['SCZJOJ2'];
$SCZJOJ3=$row['SCZJOJ3'];
$SCZJON1=$row['SCZJON1'];
$SCZJON2=$row['SCZJON2'];
$SCZJON3=$row['SCZJON3'];
$SCZJOK1=$row['SCZJOK1'];
$SCZJOK2=$row['SCZJOK2'];
$SCZJOK3=$row['SCZJOK3'];
$SCZJOW1=$row['SCZJOW1'];
$SCZJOW2=$row['SCZJOW2'];
$SCZJOW3=$row['SCZJOW3'];
$SCZABZ1=$row['SCZABZ1'];
$SCZABZ2=$row['SCZABZ2'];
$SCZABZ3=$row['SCZABZ3'];
$SCZABZ4=$row['SCZABZ4'];
$SCZABZ5=$row['SCZABZ5'];
 
 
include_once ('ExportRow1xs.php');
include_once ('ExportRow2xs.php');
include_once ('ExportRow3xs.php');
include_once ('ExportRow4xs.php');
 
 
$EKDNKDNR=$KDNKDNR;
$EMTRNSNR=$KDNBESTN;
$EKDNVTRN=$KDNVTRN;
$EKDNVMN=$KDNVMN;
$ETRANSDAT=$SCZODA4;
$EIPNR=$IPNR;
$ESCZAPD=$SCZAPD;
$ESCZZRT=$SCZZRT;
$ESCZNRSC=$KDNBESTN;
$ESCZDTGA=$SCZDTGA4;
$ESCZDTGB=$SCZDTGB4;
$ESCZDTD1=$SCZDTD14;
$ESCZDTD2=$SCZDTD24;
$ESCZDTD3=$SCZDTD34;
$ESCZDTD4=$SCZDTD44;
$ESCZDTD5=$SCZDTD54;
$ESCZNRZ1=$SCZNRZ1;
$ESCZZ011=$SCZZ011;
$ESCZZ021=$SCZZ021;
$ESCZZ031=$SCZZ031;
$ESCZZ041=$SCZZ041;
$ESCZZ051=$SCZZ051;
$ESCZZ061=$SCZZ061;
$ESCZZ071=$SCZZ071;
$ESCZZ081=$SCZZ081;
$ESCZZ091=$SCZZ091;
$ESCZZ101=$SCZZ101;
$ESCZZ111=$SCZZ111;
$ESCZZ121=$SCZZ121;
$ESCZZ131=$SCZZ131;
$ESCZZ141=$SCZZ141;
$ESCZZ151=$SCZZ151;
$ESCZZ161=$SCZZ161;
$ESCZZ171=$SCZZ171;
$ESCZZ181=$SCZZ181;
$ESCZZ191=$SCZZ191;
$ESCZZ201=$SCZZ201;
$ESCZZ211=$SCZZ211;
$ESCZZ221=$SCZZ221;
$ESCZZ231=$SCZZ231;
$ESCZZ241=$SCZZ241;
$ESCZZ251=$SCZZ251;
$ESCZZ261=$SCZZ261;
$ESCZZ271=$SCZZ271;
$ESCZZ281=$SCZZ281;
$ESCZZ291=$SCZZ291;
$ESCZZ301=$SCZZ301;
$ESCZZ311=$SCZZ311;
$ESCZZ321=$SCZZ321;
$ESCZZ331=$SCZZ331;
$ESCZZ341=$SCZZ341;
$ESCZZ351=$SCZZ351;
$ESCZZ361=$SCZZ361;
$ESCZZ371=$SCZZ371;
$ESCZZ381=$SCZZ381;
$ESCZZ391=$SCZZ391;
$ESCZZ401=$SCZZ401;
$ESCZZ411=$SCZZ411;
$ESCZZ421=$SCZZ421;
$ESCZZ431=$SCZZ431;
$ESCZZ441=$SCZZ441;
$ESCZZ451=$SCZZ451;
$ESCZZ461=$SCZZ461;
$ESCZZ471=$SCZZ471;
$ESCZZ481=$SCZZ481;
$ESCZZ491=$SCZZ491;
$ESCZZ501=$SCZZ501;
$ESCZS011=$SCZS011;
$ESCZS021=$SCZS021;
$ESCZS031=$SCZS031;
$ESCZS041=$SCZS041;
$ESCZS051=$SCZS051;
$ESCZS061=$SCZS061;
$ESCZS071=$SCZS071;
$ESCZS081=$SCZS081;
$ESCZS091=$SCZS091;
$ESCZPR01=$SCZPE01;
$ESCZGW01=$SCZGW01;
$ESCZNRZ2=$SCZNRZ2;
$ESCZZ012=$SCZZ012;
$ESCZZ022=$SCZZ022;
$ESCZZ032=$SCZZ032;
$ESCZZ042=$SCZZ042;
$ESCZZ052=$SCZZ052;
$ESCZZ062=$SCZZ062;
$ESCZZ072=$SCZZ072;
$ESCZZ082=$SCZZ082;
$ESCZZ092=$SCZZ092;
$ESCZZ102=$SCZZ102;
$ESCZZ112=$SCZZ112;
$ESCZZ122=$SCZZ122;
$ESCZZ132=$SCZZ132;
$ESCZZ142=$SCZZ142;
$ESCZZ152=$SCZZ152;
$ESCZZ162=$SCZZ162;
$ESCZZ172=$SCZZ172;
$ESCZZ182=$SCZZ182;
$ESCZZ192=$SCZZ192;
$ESCZZ202=$SCZZ202;
$ESCZZ212=$SCZZ212;
$ESCZZ222=$SCZZ222;
$ESCZZ232=$SCZZ232;
$ESCZZ242=$SCZZ242;
$ESCZZ252=$SCZZ252;
$ESCZZ262=$SCZZ262;
$ESCZZ272=$SCZZ272;
$ESCZZ282=$SCZZ282;
$ESCZZ292=$SCZZ292;
$ESCZZ302=$SCZZ302;
$ESCZZ312=$SCZZ312;
$ESCZZ322=$SCZZ322;
$ESCZZ332=$SCZZ332;
$ESCZZ342=$SCZZ342;
$ESCZZ352=$SCZZ352;
$ESCZZ362=$SCZZ362;
$ESCZZ372=$SCZZ372;
$ESCZZ382=$SCZZ382;
$ESCZZ392=$SCZZ392;
$ESCZZ402=$SCZZ402;
$ESCZZ412=$SCZZ412;
$ESCZZ422=$SCZZ422;
$ESCZZ432=$SCZZ432;
$ESCZZ442=$SCZZ442;
$ESCZZ452=$SCZZ452;
$ESCZZ462=$SCZZ462;
$ESCZZ472=$SCZZ472;
$ESCZZ482=$SCZZ482;
$ESCZZ492=$SCZZ492;
$ESCZZ502=$SCZZ502;
$ESCZS012=$SCZS012;
$ESCZS022=$SCZS022;
$ESCZS032=$SCZS032;
$ESCZS042=$SCZS042;
$ESCZS052=$SCZS052;
$ESCZS062=$SCZS062;
$ESCZS072=$SCZS072;
$ESCZS082=$SCZS082;
$ESCZS092=$SCZS092;
$ESCZPR02=$SCZPE02;
$ESCZGW02=$SCZGW02;
$ESCZNRZ3=$SCZNRZ3;
$ESCZZ013=$SCZZ013;
$ESCZZ023=$SCZZ023;
$ESCZZ033=$SCZZ033;
$ESCZZ043=$SCZZ043;
$ESCZZ053=$SCZZ053;
$ESCZZ063=$SCZZ063;
$ESCZZ073=$SCZZ073;
$ESCZZ083=$SCZZ083;
$ESCZZ093=$SCZZ093;
$ESCZZ103=$SCZZ103;
$ESCZZ113=$SCZZ113;
$ESCZZ123=$SCZZ123;
$ESCZZ133=$SCZZ133;
$ESCZZ143=$SCZZ143;
$ESCZZ153=$SCZZ153;
$ESCZZ163=$SCZZ163;
$ESCZZ173=$SCZZ173;
$ESCZZ183=$SCZZ183;
$ESCZZ193=$SCZZ193;
$ESCZZ203=$SCZZ203;
$ESCZZ213=$SCZZ213;
$ESCZZ223=$SCZZ223;
$ESCZZ233=$SCZZ233;
$ESCZZ243=$SCZZ243;
$ESCZZ253=$SCZZ253;
$ESCZZ263=$SCZZ263;
$ESCZZ273=$SCZZ273;
$ESCZZ283=$SCZZ283;
$ESCZZ293=$SCZZ293;
$ESCZZ303=$SCZZ303;
$ESCZZ313=$SCZZ313;
$ESCZZ323=$SCZZ323;
$ESCZZ333=$SCZZ333;
$ESCZZ343=$SCZZ343;
$ESCZZ353=$SCZZ353;
$ESCZZ363=$SCZZ363;
$ESCZZ373=$SCZZ373;
$ESCZZ383=$SCZZ383;
$ESCZZ393=$SCZZ393;
$ESCZZ403=$SCZZ403;
$ESCZZ413=$SCZZ413;
$ESCZZ423=$SCZZ423;
$ESCZZ433=$SCZZ433;
$ESCZZ443=$SCZZ443;
$ESCZZ453=$SCZZ453;
$ESCZZ463=$SCZZ463;
$ESCZZ473=$SCZZ473;
$ESCZZ483=$SCZZ483;
$ESCZZ493=$SCZZ493;
$ESCZZ503=$SCZZ503;
$ESCZS013=$SCZS013;
$ESCZS023=$SCZS023;
$ESCZS033=$SCZS033;
$ESCZS043=$SCZS043;
$ESCZS053=$SCZS053;
$ESCZS063=$SCZS063;
$ESCZS073=$SCZS073;
$ESCZS083=$SCZS083;
$ESCZS093=$SCZS093;
$ESCZPR03=$SCZPE03;
$ESCZGW03=$SCZGW03;
$ESCZNRZ4=$SCZNRZ4;
$ESCZZ014=$SCZZ014;
$ESCZZ024=$SCZZ024;
$ESCZZ034=$SCZZ034;
$ESCZZ044=$SCZZ044;
$ESCZZ054=$SCZZ054;
$ESCZZ064=$SCZZ064;
$ESCZZ074=$SCZZ074;
$ESCZZ084=$SCZZ084;
$ESCZZ094=$SCZZ094;
$ESCZZ104=$SCZZ104;
$ESCZZ114=$SCZZ114;
$ESCZZ124=$SCZZ124;
$ESCZZ134=$SCZZ134;
$ESCZZ144=$SCZZ144;
$ESCZZ154=$SCZZ154;
$ESCZZ164=$SCZZ164;
$ESCZZ174=$SCZZ174;
$ESCZZ184=$SCZZ184;
$ESCZZ194=$SCZZ194;
$ESCZZ204=$SCZZ204;
$ESCZZ214=$SCZZ214;
$ESCZZ224=$SCZZ224;
$ESCZZ234=$SCZZ234;
$ESCZZ244=$SCZZ244;
$ESCZZ254=$SCZZ254;
$ESCZZ264=$SCZZ264;
$ESCZZ274=$SCZZ274;
$ESCZZ284=$SCZZ284;
$ESCZZ294=$SCZZ294;
$ESCZZ304=$SCZZ304;
$ESCZZ314=$SCZZ314;
$ESCZZ324=$SCZZ324;
$ESCZZ334=$SCZZ334;
$ESCZZ344=$SCZZ344;
$ESCZZ354=$SCZZ354;
$ESCZZ364=$SCZZ364;
$ESCZZ374=$SCZZ374;
$ESCZZ384=$SCZZ384;
$ESCZZ394=$SCZZ394;
$ESCZZ404=$SCZZ404;
$ESCZZ414=$SCZZ414;
$ESCZZ424=$SCZZ424;
$ESCZZ434=$SCZZ434;
$ESCZZ444=$SCZZ444;
$ESCZZ454=$SCZZ454;
$ESCZZ464=$SCZZ464;
$ESCZZ474=$SCZZ474;
$ESCZZ484=$SCZZ484;
$ESCZZ494=$SCZZ494;
$ESCZZ504=$SCZZ504;
$ESCZS014=$SCZS014;
$ESCZS024=$SCZS024;
$ESCZS034=$SCZS034;
$ESCZS044=$SCZS044;
$ESCZS054=$SCZS054;
$ESCZS064=$SCZS064;
$ESCZS074=$SCZS074;
$ESCZS084=$SCZS084;
$ESCZS094=$SCZS094;
$ESCZPR04=$SCZPE04;
$ESCZGW04=$SCZGW04;
$ESCZNRZ5=$SCZNRZ5;
$ESCZZ015=$SCZZ015;
$ESCZZ025=$SCZZ025;
$ESCZZ035=$SCZZ035;
$ESCZZ045=$SCZZ045;
$ESCZZ055=$SCZZ055;
$ESCZZ065=$SCZZ065;
$ESCZZ075=$SCZZ075;
$ESCZZ085=$SCZZ085;
$ESCZZ095=$SCZZ095;
$ESCZZ105=$SCZZ105;
$ESCZZ115=$SCZZ115;
$ESCZZ125=$SCZZ125;
$ESCZZ135=$SCZZ135;
$ESCZZ145=$SCZZ145;
$ESCZZ155=$SCZZ155;
$ESCZZ165=$SCZZ165;
$ESCZZ175=$SCZZ175;
$ESCZZ185=$SCZZ185;
$ESCZZ195=$SCZZ195;
$ESCZZ205=$SCZZ205;
$ESCZZ215=$SCZZ215;
$ESCZZ225=$SCZZ225;
$ESCZZ235=$SCZZ235;
$ESCZZ245=$SCZZ245;
$ESCZZ255=$SCZZ255;
$ESCZZ265=$SCZZ265;
$ESCZZ275=$SCZZ275;
$ESCZZ285=$SCZZ285;
$ESCZZ295=$SCZZ295;
$ESCZZ305=$SCZZ305;
$ESCZZ315=$SCZZ315;
$ESCZZ325=$SCZZ325;
$ESCZZ335=$SCZZ335;
$ESCZZ345=$SCZZ345;
$ESCZZ355=$SCZZ355;
$ESCZZ365=$SCZZ365;
$ESCZZ375=$SCZZ375;
$ESCZZ385=$SCZZ385;
$ESCZZ395=$SCZZ395;
$ESCZZ405=$SCZZ405;
$ESCZZ415=$SCZZ415;
$ESCZZ425=$SCZZ425;
$ESCZZ435=$SCZZ435;
$ESCZZ445=$SCZZ445;
$ESCZZ455=$SCZZ455;
$ESCZZ465=$SCZZ465;
$ESCZZ475=$SCZZ475;
$ESCZZ485=$SCZZ485;
$ESCZZ495=$SCZZ495;
$ESCZZ505=$SCZZ505;
$ESCZS015=$SCZS015;
$ESCZS025=$SCZS025;
$ESCZS035=$SCZS035;
$ESCZS045=$SCZS045;
$ESCZS055=$SCZS055;
$ESCZS065=$SCZS065;
$ESCZS075=$SCZS075;
$ESCZS085=$SCZS085;
$ESCZS095=$SCZS095;
$ESCZPR05=$SCZPE05;
$ESCZGW05=$SCZGW05;
$ESCZNRZ6=$SCZNRZ6;
$ESCZZ016=$SCZZ016;
$ESCZZ026=$SCZZ026;
$ESCZZ036=$SCZZ036;
$ESCZZ046=$SCZZ046;
$ESCZZ056=$SCZZ056;
$ESCZZ066=$SCZZ066;
$ESCZZ076=$SCZZ076;
$ESCZZ086=$SCZZ086;
$ESCZZ096=$SCZZ096;
$ESCZZ106=$SCZZ106;
$ESCZZ116=$SCZZ116;
$ESCZZ126=$SCZZ126;
$ESCZZ136=$SCZZ136;
$ESCZZ146=$SCZZ146;
$ESCZZ156=$SCZZ156;
$ESCZZ166=$SCZZ166;
$ESCZZ176=$SCZZ176;
$ESCZZ186=$SCZZ186;
$ESCZZ196=$SCZZ196;
$ESCZZ206=$SCZZ206;
$ESCZZ216=$SCZZ216;
$ESCZZ226=$SCZZ226;
$ESCZZ236=$SCZZ236;
$ESCZZ246=$SCZZ246;
$ESCZZ256=$SCZZ256;
$ESCZZ266=$SCZZ266;
$ESCZZ276=$SCZZ276;
$ESCZZ286=$SCZZ286;
$ESCZZ296=$SCZZ296;
$ESCZZ306=$SCZZ306;
$ESCZZ316=$SCZZ316;
$ESCZZ326=$SCZZ326;
$ESCZZ336=$SCZZ336;
$ESCZZ346=$SCZZ346;
$ESCZZ356=$SCZZ356;
$ESCZZ366=$SCZZ366;
$ESCZZ376=$SCZZ376;
$ESCZZ386=$SCZZ386;
$ESCZZ396=$SCZZ396;
$ESCZZ406=$SCZZ406;
$ESCZZ416=$SCZZ416;
$ESCZZ426=$SCZZ426;
$ESCZZ436=$SCZZ436;
$ESCZZ446=$SCZZ446;
$ESCZZ456=$SCZZ456;
$ESCZZ466=$SCZZ466;
$ESCZZ476=$SCZZ476;
$ESCZZ486=$SCZZ486;
$ESCZZ496=$SCZZ496;
$ESCZZ506=$SCZZ506;
$ESCZS016=$SCZS016;
$ESCZS026=$SCZS026;
$ESCZS036=$SCZS036;
$ESCZS046=$SCZS046;
$ESCZS056=$SCZS056;
$ESCZS066=$SCZS066;
$ESCZS076=$SCZS076;
$ESCZS086=$SCZS086;
$ESCZS096=$SCZS096;
$ESCZPR06=$SCZPE06;
$ESCZGW06=$SCZGW06;
$ESCZNRZ7=$SCZNRZ7;
$ESCZZ017=$SCZZ017;
$ESCZZ027=$SCZZ027;
$ESCZZ037=$SCZZ037;
$ESCZZ047=$SCZZ047;
$ESCZZ057=$SCZZ057;
$ESCZZ067=$SCZZ067;
$ESCZZ077=$SCZZ077;
$ESCZZ087=$SCZZ087;
$ESCZZ097=$SCZZ097;
$ESCZZ107=$SCZZ107;
$ESCZZ117=$SCZZ117;
$ESCZZ127=$SCZZ127;
$ESCZZ137=$SCZZ137;
$ESCZZ147=$SCZZ147;
$ESCZZ157=$SCZZ157;
$ESCZZ167=$SCZZ167;
$ESCZZ177=$SCZZ177;
$ESCZZ187=$SCZZ187;
$ESCZZ197=$SCZZ197;
$ESCZZ207=$SCZZ207;
$ESCZZ217=$SCZZ217;
$ESCZZ227=$SCZZ227;
$ESCZZ237=$SCZZ237;
$ESCZZ247=$SCZZ247;
$ESCZZ257=$SCZZ257;
$ESCZZ267=$SCZZ267;
$ESCZZ277=$SCZZ277;
$ESCZZ287=$SCZZ287;
$ESCZZ297=$SCZZ297;
$ESCZZ307=$SCZZ307;
$ESCZZ317=$SCZZ317;
$ESCZZ327=$SCZZ327;
$ESCZZ337=$SCZZ337;
$ESCZZ347=$SCZZ347;
$ESCZZ357=$SCZZ357;
$ESCZZ367=$SCZZ367;
$ESCZZ377=$SCZZ377;
$ESCZZ387=$SCZZ387;
$ESCZZ397=$SCZZ397;
$ESCZZ407=$SCZZ407;
$ESCZZ417=$SCZZ417;
$ESCZZ427=$SCZZ427;
$ESCZZ437=$SCZZ437;
$ESCZZ447=$SCZZ447;
$ESCZZ457=$SCZZ457;
$ESCZZ467=$SCZZ467;
$ESCZZ477=$SCZZ477;
$ESCZZ487=$SCZZ487;
$ESCZZ497=$SCZZ497;
$ESCZZ507=$SCZZ507;
$ESCZS017=$SCZS017;
$ESCZS027=$SCZS027;
$ESCZS037=$SCZS037;
$ESCZS047=$SCZS047;
$ESCZS057=$SCZS057;
$ESCZS067=$SCZS067;
$ESCZS077=$SCZS077;
$ESCZS087=$SCZS087;
$ESCZS097=$SCZS097;
$ESCZPR07=$SCZPE07;
$ESCZGW07=$SCZGW07;
$ESCZPSUM=$SCZPSUM;
$ESCZTGEW=$SCZTGEW;
$ESCZJONN=$SCZJONN;
$ESCZJOJ1=$SCZJOJ1;
$ESCZJOJ2=$SCZJOJ2;
$ESCZJOJ3=$SCZJOJ3;
$ESCZJON1=$SCZJON1;
$ESCZJON2=$SCZJON2;
$ESCZJON3=$SCZJON3;
$ESCZJOK1=$SCZJOK1;
$ESCZJOK2=$SCZJOK2;
$ESCZJOK3=$SCZJOK3;
$ESCZJOW1=$SCZJOW1;
$ESCZJOW2=$SCZJOW2;
$ESCZJOW3=$SCZJOW3;
$ESCZABG1=$SCZABG1;
$ESCZABG2=$SCZABG2;
$ESCZABG3=$SCZABG3;
$ESCZABG4=$SCZABG4;
$ESCZABG5=$SCZABG5;
 
$csvdata=$EKDNKDNR.";".$EMTRNSNR.";".$EKDNVTRN.";".$EKDNVMN.";".$ETRANSDAT.";".$EIPNR.";".$ESCZAPD.";".$ESCZZRT.";".$ESCZNRSC.";".$ESCZDTGA.";".$ESCZDTGB.";".$ESCZDTD1.";".$ESCZDTD2.";".$ESCZDTD3.";".$ESCZDTD4.";".$ESCZDTD5.";".$ESCZNRZ1.";".$ESCZZ011.";".$ESCZZ021.";".$ESCZZ031.";".$ESCZZ041.";".$ESCZZ051.";".$ESCZZ061.";".$ESCZZ071.";".$ESCZZ081.";".$ESCZZ091.";".$ESCZZ101.";".$ESCZZ111.";".$ESCZZ121.";".$ESCZZ131.";".$ESCZZ141.";".$ESCZZ151.";".$ESCZZ161.";".$ESCZZ171.";".$ESCZZ181.";".$ESCZZ191.";".$ESCZZ201.";".$ESCZZ211.";".$ESCZZ221.";".$ESCZZ231.";".$ESCZZ241.";".$ESCZZ251.";".$ESCZZ261.";".$ESCZZ271.";".$ESCZZ281.";".$ESCZZ291.";".$ESCZZ301.";".$ESCZZ311.";".$ESCZZ321.";".$ESCZZ331.";".$ESCZZ341.";".$ESCZZ351.";".$ESCZZ361.";".$ESCZZ371.";".$ESCZZ381.";".$ESCZZ391.";".$ESCZZ401.";".$ESCZZ411.";".$ESCZZ421.";".$ESCZZ431.";".$ESCZZ441.";".$ESCZZ451.";".$ESCZZ461.";".$ESCZZ471.";".$ESCZZ481.";".$ESCZZ491.";".$ESCZZ501.";".$ESCZS011.";".$ESCZS021.";".$ESCZS031.";".$ESCZS041.";".$ESCZS051.";".$ESCZS061.";".$ESCZS071.";".$ESCZS081.";".$ESCZS091.";".$ESCZPR01.";".$ESCZGW01.";".$ESCZNRZ2.";".$ESCZZ012.";".$ESCZZ022.";".$ESCZZ032.";".$ESCZZ042.";".$ESCZZ052.";".$ESCZZ062.";".$ESCZZ072.";".$ESCZZ082.";".$ESCZZ092.";".$ESCZZ102.";".$ESCZZ112.";".$ESCZZ122.";".$ESCZZ132.";".$ESCZZ142.";".$ESCZZ152.";".$ESCZZ162.";".$ESCZZ172.";".$ESCZZ182.";".$ESCZZ192.";".$ESCZZ202.";".$ESCZZ212.";".$ESCZZ222.";".$ESCZZ232.";".$ESCZZ242.";".$ESCZZ252.";".$ESCZZ262.";".$ESCZZ272.";".$ESCZZ282.";".$ESCZZ292.";".$ESCZZ302.";".$ESCZZ312.";".$ESCZZ322.";".$ESCZZ332.";".$ESCZZ342.";".$ESCZZ352.";".$ESCZZ362.";".$ESCZZ372.";".$ESCZZ382.";".$ESCZZ392.";".$ESCZZ402.";".$ESCZZ412.";".$ESCZZ422.";".$ESCZZ432.";".$ESCZZ442.";".$ESCZZ452.";".$ESCZZ462.";".$ESCZZ472.";".$ESCZZ482.";".$ESCZZ492.";".$ESCZZ502.";".$ESCZS012.";".$ESCZS022.";".$ESCZS032.";".$ESCZS042.";".$ESCZS052.";".$ESCZS062.";".$ESCZS072.";".$ESCZS082.";".$ESCZS092.";".$ESCZPR01.";".$ESCZGW01.";".$ESCZNRZ3.";".$ESCZZ013.";".$ESCZZ023.";".$ESCZZ033.";".$ESCZZ043.";".$ESCZZ053.";".$ESCZZ063.";".$ESCZZ073.";".$ESCZZ083.";".$ESCZZ093.";".$ESCZZ103.";".$ESCZZ113.";".$ESCZZ123.";".$ESCZZ133.";".$ESCZZ143.";".$ESCZZ153.";".$ESCZZ163.";".$ESCZZ173.";".$ESCZZ183.";".$ESCZZ193.";".$ESCZZ203.";".$ESCZZ213.";".$ESCZZ223.";".$ESCZZ233.";".$ESCZZ243.";".$ESCZZ253.";".$ESCZZ263.";".$ESCZZ273.";".$ESCZZ283.";".$ESCZZ293.";".$ESCZZ303.";".$ESCZZ313.";".$ESCZZ323.";".$ESCZZ333.";".$ESCZZ343.";".$ESCZZ353.";".$ESCZZ363.";".$ESCZZ373.";".$ESCZZ383.";".$ESCZZ393.";".$ESCZZ403.";".$ESCZZ413.";".$ESCZZ423.";".$ESCZZ433.";".$ESCZZ443.";".$ESCZZ453.";".$ESCZZ463.";".$ESCZZ473.";".$ESCZZ483.";".$ESCZZ493.";".$ESCZZ503.";".$ESCZS013.";".$ESCZS023.";".$ESCZS033.";".$ESCZS043.";".$ESCZS053.";".$ESCZS063.";".$ESCZS073.";".$ESCZS083.";".$ESCZS093.";".$ESCZPR03.";".$ESCZGW03.";".$ESCZNRZ4.";".$ESCZZ014.";".$ESCZZ024.";".$ESCZZ034.";".$ESCZZ044.";".$ESCZZ054.";".$ESCZZ064.";".$ESCZZ074.";".$ESCZZ084.";".$ESCZZ094.";".$ESCZZ104.";".$ESCZZ114.";".$ESCZZ124.";".$ESCZZ134.";".$ESCZZ144.";".$ESCZZ154.";".$ESCZZ164.";".$ESCZZ174.";".$ESCZZ184.";".$ESCZZ194.";".$ESCZZ204.";".$ESCZZ214.";".$ESCZZ224.";".$ESCZZ234.";".$ESCZZ244.";".$ESCZZ254.";".$ESCZZ264.";".$ESCZZ274.";".$ESCZZ284.";".$ESCZZ294.";".$ESCZZ304.";".$ESCZZ314.";".$ESCZZ324.";".$ESCZZ334.";".$ESCZZ344.";".$ESCZZ354.";".$ESCZZ364.";".$ESCZZ374.";".$ESCZZ384.";".$ESCZZ394.";".$ESCZZ404.";".$ESCZZ414.";".$ESCZZ424.";".$ESCZZ434.";".$ESCZZ444.";".$ESCZZ454.";".$ESCZZ464.";".$ESCZZ474.";".$ESCZZ484.";".$ESCZZ494.";".$ESCZZ504.";".$ESCZS014.";".$ESCZS024.";".$ESCZS034.";".$ESCZS044.";".$ESCZS054.";".$ESCZS064.";".$ESCZS074.";".$ESCZS084.";".$ESCZS094.";".$ESCZPR04.";".$ESCZGW04.";".$ESCZNRZ5.";".$ESCZZ015.";".$ESCZZ025.";".$ESCZZ035.";".$ESCZZ045.";".$ESCZZ055.";".$ESCZZ065.";".$ESCZZ075.";".$ESCZZ085.";".$ESCZZ095.";".$ESCZZ105.";".$ESCZZ115.";".$ESCZZ125.";".$ESCZZ135.";".$ESCZZ145.";".$ESCZZ155.";".$ESCZZ165.";".$ESCZZ175.";".$ESCZZ185.";".$ESCZZ195.";".$ESCZZ205.";".$ESCZZ215.";".$ESCZZ225.";".$ESCZZ235.";".$ESCZZ245.";".$ESCZZ255.";".$ESCZZ265.";".$ESCZZ275.";".$ESCZZ285.";".$ESCZZ295.";".$ESCZZ305.";".$ESCZZ315.";".$ESCZZ325.";".$ESCZZ335.";".$ESCZZ345.";".$ESCZZ355.";".$ESCZZ365.";".$ESCZZ375.";".$ESCZZ385.";".$ESCZZ395.";".$ESCZZ405.";".$ESCZZ415.";".$ESCZZ425.";".$ESCZZ435.";".$ESCZZ445.";".$ESCZZ455.";".$ESCZZ465.";".$ESCZZ475.";".$ESCZZ485.";".$ESCZZ495.";".$ESCZZ505.";".$ESCZS015.";".$ESCZS025.";".$ESCZS035.";".$ESCZS045.";".$ESCZS055.";".$ESCZS065.";".$ESCZS075.";".$ESCZS085.";".$ESCZS095.";".$ESCZPR05.";".$ESCZGW05.";".$ESCZNRZ6.";".$ESCZZ016.";".$ESCZZ026.";".$ESCZZ036.";".$ESCZZ046.";".$ESCZZ056.";".$ESCZZ066.";".$ESCZZ076.";".$ESCZZ086.";".$ESCZZ096.";".$ESCZZ106.";".$ESCZZ116.";".$ESCZZ126.";".$ESCZZ136.";".$ESCZZ146.";".$ESCZZ156.";".$ESCZZ166.";".$ESCZZ176.";".$ESCZZ186.";".$ESCZZ196.";".$ESCZZ206.";".$ESCZZ216.";".$ESCZZ226.";".$ESCZZ236.";".$ESCZZ246.";".$ESCZZ256.";".$ESCZZ266.";".$ESCZZ276.";".$ESCZZ286.";".$ESCZZ296.";".$ESCZZ306.";".$ESCZZ316.";".$ESCZZ326.";".$ESCZZ336.";".$ESCZZ346.";".$ESCZZ356.";".$ESCZZ366.";".$ESCZZ376.";".$ESCZZ386.";".$ESCZZ396.";".$ESCZZ406.";".$ESCZZ416.";".$ESCZZ426.";".$ESCZZ436.";".$ESCZZ446.";".$ESCZZ456.";".$ESCZZ466.";".$ESCZZ476.";".$ESCZZ486.";".$ESCZZ496.";".$ESCZZ506.";".$ESCZS016.";".$ESCZS026.";".$ESCZS036.";".$ESCZS046.";".$ESCZS056.";".$ESCZS066.";".$ESCZS076.";".$ESCZS086.";".$ESCZS096.";".$ESCZPR06.";".$ESCZGW06.";".$ESCZNRZ7.";".$ESCZZ017.";".$ESCZZ027.";".$ESCZZ037.";".$ESCZZ047.";".$ESCZZ057.";".$ESCZZ067.";".$ESCZZ077.";".$ESCZZ087.";".$ESCZZ097.";".$ESCZZ107.";".$ESCZZ117.";".$ESCZZ127.";".$ESCZZ137.";".$ESCZZ147.";".$ESCZZ157.";".$ESCZZ167.";".$ESCZZ177.";".$ESCZZ187.";".$ESCZZ197.";".$ESCZZ207.";".$ESCZZ217.";".$ESCZZ227.";".$ESCZZ237.";".$ESCZZ247.";".$ESCZZ257.";".$ESCZZ267.";".$ESCZZ277.";".$ESCZZ287.";".$ESCZZ297.";".$ESCZZ307.";".$ESCZZ317.";".$ESCZZ327.";".$ESCZZ337.";".$ESCZZ347.";".$ESCZZ357.";".$ESCZZ367.";".$ESCZZ377.";".$ESCZZ387.";".$ESCZZ397.";".$ESCZZ407.";".$ESCZZ417.";".$ESCZZ427.";".$ESCZZ437.";".$ESCZZ447.";".$ESCZZ457.";".$ESCZZ467.";".$ESCZZ477.";".$ESCZZ487.";".$ESCZZ497.";".$ESCZZ507.";".$ESCZS017.";".$ESCZS027.";".$ESCZS037.";".$ESCZS047.";".$ESCZS057.";".$ESCZS067.";".$ESCZS077.";".$ESCZS087.";".$ESCZS097.";".$ESCZPR07.";".$ESCZGW07.";".$ESCZPSUM.";".$ESCZTGEW.";".$ESCZJONN.";".$ESCZJOJ1.";".$ESCZJOJ2.";".$ESCZJOJ3.";".$ESCZJON1.";".$ESCZJON2.";".$ESCZJON3.";".$ESCZJOK1.";".$ESCZJOK2.";".$ESCZJOK3.";".$ESCZJOW1.";".$ESCZJOW2.";".$ESCZJOW3.";".$ESCZABG1.";".$ESCZABG2.";".$ESCZABG3.";".$ESCZABG4.";".$ESCZABG5."\n";
 
 
  fwrite($fp,$csvdata);   // MAN PAGE http://us.php.net/manual/en/function.fputcsv.php
}
 
// ALL DONE
fclose($fp);
}
 
 
echo $KDNKDNR;
 
 
 
?>

Open in new window

Author

Commented:
The includes are external formattiing and if elseif sequences that fill in the fields below not covered in the query.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial