无法将数据库连接到PHP

时间:2019-03-28 11:34:17

标签: php sql database phpmyadmin connect

我正在尝试将我的php文件连接到phpmyadmin数据库。这是我要执行的代码,但是,当我单击表单上的提交时,它仅显示源代码:

<?php
$servername = "localhost";
$username = "username";
$password = "password";

// Create connection
$conn = new mysqli($servername, $username, $password);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 
echo "Connected successfully";
?>

0 个答案:

没有答案