<!doctype HTML>
<head>
<title>Soccer.db | The Ultimate Database for Soccer Stats, Info, & News</title>
<link rel="stylesheet" href="football.css" />
</head>
<body>
<?php
$host = "localhost";
$username = "root";
$password = "root";
$db = "soccerdb";
$db_con = new mysqli($host, $username, $password, $db);
if ($db_con->connect_errno) {
echo "Failed to connecto to MySQL: (" . $db_con->connect_errno . ") " . $db_con->connect_error;
}
echo $db_con->host_info . "\n";
$result = mysqli_query($db_con, "SELECT * FROM players");
$db_con->close();
?>
<div class="top-nav-wrapper">
<div class="top-nav-content">
<span>Soccer.db</span>
</div>
</div>
<div class="long-ad-wrapper">
<div class="long-ad-content">
</div>
</div>
<?php
echo "<table>";
while($row = mysqli_fetch_array($result)){
echo "<tr><td>" . $row['firstname'] . "</td><td>" . $row['lastname'] . "</td> <td>" . $row['age'] . "</td></tr>";
echo "</table>";
}
?>
</body>
我收到错误1049我的数据库不存在,虽然使用phpmyadmin,我确定它存在。我还阅读了一些建议并尝试更改名称,但仍然无效。感谢。
编辑:Pic of phpmyadmin绝对没有空格和大写是正确的。 Root是密码,当我将其更改为&#39;时它会断开连接。 &#39;
答案 0 :(得分:0)