MySQL データベースのデータを txt ファイルに書き込もうとしています。現在、htmlのテキストエリアタグに入れていますが、代わりにtxtファイルに入れられないようです。これが私がテキストエリアとして持っているものです:
$pairresult = mysqli_query($conmysql,"SELECT * FROM orders WHERE order_number IN ( SELECT order_number FROM orders GROUP BY order_number HAVING count(ordern_number) > 1 ) ORDER BY order_number");
echo "<h4>Customers with Multiple Orders</h4><textarea rows=\"5\" cols=\"90\" readonly>";
while($row = mysqli_fetch_array($pairresult))
{
echo str_replace("&","\&",$row['shipment_address_name']) . "\n";
echo str_replace("&","\&",$row['shipment_address_street']) . "\n";
if ( !empty($row['shipment_address_street_2']) ) {
echo str_replace("&","\&",$row['shipment_address_street_2']) . "\n";
} else {
}
echo str_replace("&","\&",$row['shipment_address_city']) . "\n";
echo str_replace("&","\&",$row['shipment_address_postal_code']) . "\n";
if ( !empty($row['customer_phone']) ) {
echo str_replace("&","\&",$row['customer_phone']) . "\n";
} else {
}
echo "(" . $row['fulfillment_line_item_id'] . ")\n";
echo "[" . $row['item_name'] . "]\n\n";
}
echo "</textarea><br />";
スクリプトの別の部分にも同様のビットがありますが、txt ファイルに正常に書き込む if ステートメントなどはありません。
$pairresult = mysqli_query($conmysql,"SELECT * FROM orders WHERE order_number IN ( SELECT order_number FROM orders GROUP BY order_number HAVING count(order_number) > 1 ) ORDER BY order_number");
while($row = mysqli_fetch_array($pairresult))
{
$multiple = "productmultiple_tracking($filetimestamp).csv";
$handle = fopen($grouponmultiple, 'a') or die('Cannot open file: '.$multiple);
$data = "\"" . $row['fulfillment_line_item_id'] . "\",\"" . $row['fulfillment_line_item_id'] . "\",\"YDL\",\"\"\n";
fwrite($handle, $data);
fclose($handle);
}
echo "<a href=\"$multiple\">Download Template</a><br />";
テキストエリアのそのビットを同じ形式のtxtファイルに取得するにはどうすればよいですか?