Home > Backend Development > PHP Tutorial > 最后关闭数据库时,提示语法错误,新手问题,谢谢

最后关闭数据库时,提示语法错误,新手问题,谢谢

WBOY
Release: 2016-06-23 14:09:26
Original
1320 people have browsed it

Parse error: syntax error, unexpected T_OBJECT_OPERATOR in F:\www\study\authmain.php on line

session_start();

if (isset($_POST['userid']) && isset($_POST['password']))
{
$userid=$_POST['userid'];
$password=$_POST['password'];

$db_conn=new mysqli('localhost','webauth','webauth','auth');
if (mysqli_connect_errno()) {
echo 'Connection to database failed:'.mysqli_connect_error();
exit();

}

$query='Select * from authorized_users where name='. $userid." and password=sha1('$password')";
$result=$db_conn->query($query);
if ($result->num_rows)
{
$_SESSION['valid_user']=$userid;
}

$db_conn->close();


}
?>


回复讨论(解决方案)

提示哪行出错

请指出出现错误的行号

最后一行close

Parse error: syntax error, unexpected T_OBJECT_OPERATOR in F:\www\study\authmain.php on line 23

最后多了个分号

写错了,是多了个括号,最后的括号去掉。

写错了,是多了个括号,最后的括号去掉。

谢谢!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template