Php exports mysql data to generate a. SQL file. Php Tutorial export mysql tutorial data table data generation. SQL file $ database; database tutorial name $ optionsarray (hostname, IP address charsetutf8, encoding filename $ php Tutorial export mysql tutorial data table data generation. SQL file
$ Database = ''; // database tutorial name
$ Options = array (
'Hostname' => '', // IP address
'Charset' => 'utf8', // encoding
'Filename' => $ database. '. SQL', // file name
'Username' => '',
'Password' =>''
);
Mysql_connect ($ options ['hostname'], $ options ['username'], $ options ['password']) or die ("The database cannot be connected! ");
Mysql_select_db ($ database) or die ("The database name is incorrect! ");
Mysql_query ("set names '{$ options ['charset']}'");
$ Data = get_insert_ SQL ($ table );
Function get_insert_ SQL ($ table, $ row)
{
$ SQL = "INSERT INTO '{$ table}' VALUES (";
$ Values = array ();
Foreach ($ row as $ value ){
$ Values [] = "'". mysql_real_escape_string ($ value )."'";
}
$ SQL. = implode (',', $ values ).");";
Return $ SQL;
}
Export mysql tutorial data table data generation. SQL file $ database = ''; // database tutorial name $ options = array ('hostname' ='', // IP address 'charset' = 'utf8 ', // Encode 'filename' = $...