Page 2 of 2
Posted: Tue Feb 21, 2006 1:42 pm
by $var
i didn't fix it.. it's still not liking the first attempt... hmmm.
and the error thing you send didn't turn anything up either.
that's so fishy.
Posted: Tue Feb 21, 2006 1:42 pm
by feyd
what echos? The only ones I see are error returns.
I guess it's time to debug it like mad: comment out the header call, add echos giving out line numbers (__LINE__) in each if, beginning and ending of a loop, etc..
Posted: Tue Feb 21, 2006 2:33 pm
by s.dot
Try This
Code: Select all
<?
$file = "surveys.txt";
$select = "SELECT * FROM `surveys` WHERE `Mem_ID` = ".$ID;
$export = mysql_query($select) or die(mysql_error());
while($row = mysql_fetch_assoc($export)){
print_r($row);
$fields = count($row);
for ($i = 0; $i < $fields; $i++){
$header .= mysql_field_name($row[$i])."\t";
$line = '';
foreach($row as $value){
if (empty($value)){
$value = "\t";
} else {
$value = str_replace('"', '""', $value);
$value = '"' . $value . '"' . "\t";
}
echo $value;
$line .= $value;
}
$data .= trim($line)."\n";
echo $data;
}
}
$data = str_replace("\r","",$data);
if (empty($data)){
$data = "\n(0) Records Found!\n";
} ELSE {
if (!$file_handle = fopen($file,"a")) { echo "Cannot open file"; }
if (!fwrite($file_handle, $data)) { echo "Cannot write to file"; }
header("Location: http://www.advantageboard.com/access/02 ... elcome.php");
fclose($file_handle);
}
?>
Rewrote it in functions that I understand and added some debug info
