Hie.My php代码在我的browser.its上返回实际代码。没有给出output.it只显示代码。
<?php
$servername = "localhost";
$username = "root";
$password = "";
$db_name="agric";
// Create connection
$conn = new mysqli_connect("$servername", "$username", "$password",);
mysql_select_db($db_name)or die("Could not connect to database");
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?>
我的数据库是agric,我使用xampp创建它。有人帮我解决了问题。