Undefined variable error after export data to csv
<p>i try to learn how to export data to csv using this script, yes i can export all data but in csv i found one error(when run in localhost) :</p>

<pre><code>&lt;b&gt;Notice&lt;/b&gt;:  Undefined variable: csv_output in &lt;b&gt;C:\xampp\htdocs\import_export\index.php&lt;/b&gt; on line &lt;b&gt;10&lt;/b&gt;&lt;br /&gt;
</code></pre>

<p>not sure why, but i can run this code in live server without any issue.</p>

<p>Full code</p>

<pre><code>error_reporting(E_ALL);

mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("csv") or die(mysql_error());

$file  = "product_export"; // csv name.

//CSV Header
$csv_output .= "ID " . ", ";
$csv_output .= "Content " . ", ";

$csv_output .= "\n";

//CSV Content rows
$query = mysql_query("SELECT * FROM `users`");
while ($row = mysql_fetch_array($query)) {
    $csv_output .= $row["id"] . ", ";
    $csv_output .= $row["content"] . ", ";

    $csv_output .= "\n";
}

$filename = $file . "_" . date("d-m-Y_H-i");

header("Content-type: application/vnd.ms-excel");
header("Content-disposition: csv" . date("Y-m-d") . ".csv");
header("Content-disposition: filename=" . $filename . ".csv");

print $csv_output;

exit;
</code></pre>

<p>p/s : im using mysql_* for testing only.</p>
