我正在尝试通过 PHP 回显显示数据库表中的值。MySQL 结果是双精度 (10, 2)。
<?php $link = new mysqli('127.0.0.1', '*******', '*******', '*******');
if ($link->connect_errno) {
die('Failed to connect to MySQL: (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error);
}
$user = $_SESSION['user'];
$result = $link->query("SELECT * FROM users WHERE username='$user' AND active=1");
$numrows = $result->num_rows;
if($numrows == 0 || $numrows > 1)
{
$link->close();
session_destroy();
echo '<META HTTP-EQUIV="Refresh" Content="0; URL=**************">';
exit;
}
else if($numrows == 1)
{
//$sid = $result(8);
echo '<strong>this is my string in which i want to show the result in' . $result(8) . 'rest of the string';}?>
显示错误的行是回声线(最后)。谁能指出我在这里做错了什么?谢谢你。