PHP Tutorial Export MySQL Tutorial data sheet data generation. sql file
$database = ";//Database tutorial name
$options =array (
' Hostname ' = ', '//IP address
' CharSet ' = ' utf8 ',//coded
' filename ' = ' $database. ' SQL ',//file name
' Username ' = ',
' Password ' and ' = '
);
mysql_connect ($options [' hostname '], $options [' username '], $options [' Password ']) or Die ("Cannot connect to database!");
mysql_select_db ($database) or Die ("database name is wrong!");
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;
}
http://www.bkjia.com/PHPjc/630882.html www.bkjia.com true http://www.bkjia.com/PHPjc/630882.html techarticle PHP Tutorial export MySQL tutorial data table data generation. sql file $database = ";//Database tutorial name $options =array (' hostname ' = ',//ip address ' charset ' = ' utf8 ',//code ' F ') Ilename ' = $ ...