PHP :: mySQLi从现有的sql文件创建一个新表(如果不存在)

时间:2015-02-10 16:22:22

标签: php mysql apache mysqli server

是否可以从现有的sql文件创建表(如果不存在)?

$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "myDB";

$conn = new mysqli($servername, $username, $password, $dbname);

$sql = "CREATE TABLE IF NOT EXISTS {FROM FILE : myFile.SQL}";

if ($conn->query($sql) === TRUE) {
    echo "updated successfully";
} else {
    echo "Error updating" . $conn->error;
}

$conn->close();

0 个答案:

没有答案