???????????php??????.sql?????????????????sql????е?????????????sql???????????????
????????????
//??????????
$_sql = file_get_contents('test.sql');
$_arr = explode(';'?? $_sql);
$_mysqli = new mysqli(DB_HOST??DB_USER??DB_PASS);
if (mysqli_connect_errno()) {
exit('????????????');
}
//???sql???
foreach ($_arr as $_value) {
$_mysqli->query($_value.';');
}
$_mysqli->close();
$_mysqli = null;
????????text.sql?????????е?sql?????DB_HOST????????DB_USER???????DB_PASS????!
????????????????????sql??????????????????????????????????????sql???????????????
????CREATE DATABASE IF NOT EXISTS ??????? DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
????USE ???????
?????????text.php????????е?sql??????????
????$_mysqli->query("CREATE DATABASE IF NOT EXISTS ??????? DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;");
????$_mysqli->query("USE ???????");
??????????????????????????????????