我正在尝试使用面向对象的代码在数据库中显示用户(管理),变量加载了正确的连接信息,我的数据库代码是
/* Code to Connect to the Database */
$mysqli = new mysqli($host, $username, $password);
if($mysqli->connect_errno){
echo "Failed to connect to the Database: " . $mysql->connect_error;
}
我用来显示用户的代码是
$query = ("SELECT m_username, m_email, m_fname, m_sname, m_mccode, m_mobile FROM management");
if ($result = $mysqli->query($query)) {
/* fetch associative array */
while ($row = $result->fetch_assoc()) {
printf ($row["m_username"], $row["m_email"], $row["m_fname"], $row["m_sname"], $row["m_mccode"], $row["m_mobile"]);
}
/* Frees the result set */
$result->close();
/* Close the Connection */
$mysqli->close();
}
当我转到包含此代码的页面时,我什么也没有显示,并且数据库中有用户。