我试图通过PHP回显显示从数据库表中的值。 MySQL的结果是双倍(10,2)。PHP的MySQL - 致命的错误:函数名称必须是一个字符串
<?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';}?>
错误显示的行是回显行(最后)。任何人都可以指出我在这里做错了吗?谢谢。
$ result是查询(资源)的链接,您必须首先获取结果。 – Waygood 2013-05-01 17:58:34