Re: Exporting data from database using fopen
| From: | Vern | Date: | Fri, 13 Aug 2004 16:18:33 +0000 |
| Subject: | Re: Exporting data from database using fopen | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-193714@lists.php.net to get a copy of this message | ||
Sorry the previous post got sent prematurely.
It does work, however, the problem is in the
fwrite($fp, "$rsITEMS->Fields('item_id')\n");
what gets written to the file is exactly "$rsITEMS->Fields('item_id')" for
as many records are return when I want the value to be inserted in the file.
I've also tried echo $rsITEMS->Fields('item_id'), but then that is returned
exactly that was as well.
Here's the code again:
<?php
//LOOP THROUGH RECORDSET
while (!$rsITEMS->EOF) {
//CREATE CSV
//OPEN DUMP FILE
$fp = fopen("./dump.sql", "w");
//WRITE DATA TO DUMP
fwrite($fp, "$rsITEMS->Fields('item_id')\n");
//LOOP
$rsITEMS->MoveNext();
}
//CLOSE FILE
fclose($fp);
?>