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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: smime.p7s
Description: S/MIME cryptographic signature


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux