I am trying to create a csv file from a table in a mysql database using the following code. No errors come up, but nothing happens either...
I know that i am connected to the database properly because earlier in my code a number of tables from the database are selected and that works fine. the first line is simply to make the script wait to act until i have submitted the form. The echo statements seem to be outputting what i want, but this file doesn't work.
if (isset($_POST['add_item'])){
$table = $_POST['tName'];
$sql = 'SELECT * INTO OUTFILE "csv/unconvert_tester.csv" FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '. mysql_real_escape_string('"') .' LINES TERMINATED BY "\n" FROM '."$table";
$result = mysql_query("$sql");
echo("$sql <br>");
echo("file created for $table");
}