Php exports the data structure and generates a. SQL file. The php Tutorial exports the data structure and then generates the. SQL file $ database; database tutorial name $ optionsarray (hostname, IP address charsetutf8, encoding filename $ database.. s php Tutorial exports the data structure and then generates the. SQL file
$ Database = ''; // database tutorial name
$ Options = array (
'Hostname' => '', // IP address
'Charset' => 'utf8', // encoding
'Filename' => $ database. '. SQL', // file name
'Username' => '',
'Password' =>''
);
Mysql tutorial _ 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 dump_table ($ table, $ fp = null)
{
$ Need_close = false;
If (is_null ($ fp )){
$ Fp = fopen ($ table. '. SQL', 'w ');
$ Need_close = true;
}
$ A = mysql_query ("show create table '{$ table }"');
$ Row = mysql_fetch_assoc ($ a); fwrite ($ fp, $ row ['create Table']. ';'); // export the Table structure
$ Rs = mysql_query ("SELECT * FROM '{$ table }"');
While ($ row = mysql_fetch_row ($ rs )){
Fwrite ($ fp, get_insert_ SQL ($ table, $ row ));
}
Mysql_free_result ($ rs );
If ($ need_close ){
Fclose ($ fp );
}
}
The producer exports the data structure and generates it again. SQL file $ database = ''; // database tutorial name $ options = array ('hostname' ='', // IP address 'charset' = 'utf8 ', // Encode 'filename' = $ database. '. s...