解析错误:语法错误,意外'回声' (T_ECHO)在第12行的C:\ ...中

时间:2017-03-15 22:18:41

标签: php mysql syntax

我环顾四周无法找到有助于我的答案,也无法看到任何明显的问题。我收到了这个错误:

  

解析错误:语法错误,意外'回声' (T_ECHO)在C:......上   第12行

<?php

include 'dbh.php';

$uid = $_POST['uid'];
$pwd = $_POST['pwd'];

$sql = "SELECT * FROM user WHERE uid='$uid' AND pwd='$pwd'";
$result = mysqli_query($conn, $sql);

if (!$row = mysqli_fetch_assoc($result) {
    echo "Your username or password is incorrect!";
} else {
    echo "You are logged in!";
}

感谢任何帮助!

1 个答案:

答案 0 :(得分:0)

您在if()声明中错过了一个paren:

<?php

include 'dbh.php';

$uid = $_POST['uid'];
$pwd = $_POST['pwd'];

$sql = "SELECT * FROM user WHERE uid='$uid' AND pwd='$pwd'";
$result = mysqli_query($conn, $sql);

if (!$row = mysqli_fetch_assoc($result)) {
    echo "Your username or password is incorrect!";
} else {
    echo "You are logged in!";
}