
umpty
Novice
Feb 16, 2003, 9:24 AM
Post #1 of 7
(382 views)
|
|
Writing DB results to File
|
Can't Post
|
|
The following code:
use OLE; $conn = CreateObject OLE "ADODB.Connection" || die "CreateObject: $!"; $conn->Open ('OGCParse'); $sql = "SELECT * FROM Output"; $rs = $conn->Execute($sql); while(!$rs->EOF()) { $myFile = $rs->Fields('File')->Value; $myHandle = $rs->Fields('Handle')->Value; write; $rs->MoveNext(); } $rs->Close(); $conn->Close(); produces the following output: 1000.txt 833E14D1-621E-11D3-9741-00805FE246D4 8200.txt A6C0BD67P92A9P11D1P96F8P00805FE246D4 9000.txt 37ad22c5-5232-11d1-96ee-00805fe246d4 Question: How would I modify the script to produce a text file for each record in the DB where each field would be displayed on a separate line (using the first field as the name of the text file). Thus, the format in each file would be in the following format: File 1000.txt would look like this: 1000.txt 833E14D1-621E-11D3-9741-00805FE246D4 and File 8200.txt would look like this: 8200.txt A6C0BD67P92A9P11D1P96F8P00805FE246D4 and so on and so forth... Thanks.
|