Re: better way to create custom text file from query results?

From: Date: Wed, 07 Jun 2006 13:07:00 +0000
Subject: Re: better way to create custom text file from query results?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-237557@lists.php.net to get a copy of this message
I guess I was just "talking the problem out." :-) Writing that post helped me think of iterating through $_POST. Now I've come to this problem: Before I did this and it works: while ($row=@mysql_fetch_array($result)) { if ($fieldname1) $output.="$row[fieldname1]\t"; if ($fieldname2) $output.="$row[fieldname2]\t"; } Trying to tighten up as discussed with this, but doesn't work: while ($row=@mysql_fetch_array($result)) { foreach ($_POST as $key => $data) if ($data) {$output.="$row[" . $key . "]\t"; } // foreach } // end while $row The above throws a "Parse error: parse error, expecting `T_STRING' or T_VARIABLE' or T_NUM_STRING' in...." error. This substitution: if ($data) {$output.="$row[$key]\t"; eliminates the aforementioned error, but does not produce the desired results. On Jun 7, 2006, at 8:26 AM, chris smith wrote:
If in doubt give something a try. :)


Attachment: [application/pkcs7-signature] smime.p7s
« previous php.general (#237557) next »