export.csv
// Connect database
$database="epeiro_base1";
$table="mailtech";
mysql_connect("192.185.17.57","epeiro_browser","hallmark");
mysql_select_db("epeiro_base1");
$result=mysql_query("select * from $table");
$out = '';
// Get all fields names in table "name_list" in database "tutorial".
$fields = mysql_list_fields($database,$table);
// Count the table fields and put the value into $columns.
$columns = mysql_num_fields($fields);
// Put the name of all fields to $out.
for ($i = 0; $i < $columns; $i++) {
$l=mysql_field_name($fields, $i);
$out .= '"'.$l.'";';
}
$out .="\n";
// Add all values in the table to $out.
while ($l = mysql_fetch_array($result)) {
for ($i = 0; $i < $columns; $i++) {
$out .='"'.$l["$i"].'";';
}
$out .="\n";
}
// Open file export.csv.
$f = fopen ('export.csv','w');
// Put all values from $out to export.csv.
fputs($f, $out);
fclose($f);
//header("location:export.csv");
?>
Warning: require_once(../envios2/Connections/cbtech_mysql.php): Failed to open stream: No such file or directory in /home/aprender21.es/public_html/apps/send-export.php on line 2
Fatal error: Uncaught Error: Failed opening required '../envios2/Connections/cbtech_mysql.php' (include_path='.:') in /home/aprender21.es/public_html/apps/send-export.php:2
Stack trace:
#0 /home/aprender21.es/public_html/apps/export.php(44): include()
#1 {main}
thrown in /home/aprender21.es/public_html/apps/send-export.php on line 2