Exports table from a database from PHP with SQL format

0

Greetings I tried to export a table from a database from PHP but I think I'm not using the correct extension. Please explain and thank you in advance.

    
asked by Esme 03.03.2018 в 07:47
source

1 answer

-1

Try the following:

<?php
$bd_host = "localhost";
$bd_user = "xxx";
$bd_pass = "xxx";
$bd_nombre = "xxx";

$con = new mysqli($bd_host, $bd_user, $bd_pass, $bd_nombre);
if($con->connect_errno > 0) {
   die('Conexion fallida [' . $db->connect_error . ']');
}

$tbl_nombre  = 'tu_tabla';
$respaldoSQL = 'respaldo/tu_tabla.sql'; 
$query = "select * into outfile '$respaldoSQL' FROM $tbl_nombre";
$result = mysqli_query($con,$query);
?>

In 'backup / tu_table.sql' (you must specify the path where the file with the .sql extension will be saved)

    
answered by 09.03.2018 / 09:36
source