-2

I've looked around can't find an answer that helps me and can't see any obvious problems. I've been getting this error:

Parse error: syntax error, unexpected 'echo' (T_ECHO) in C:... on line 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!";
}

Any help is appreciated!

1 Answers1

0

You are missing a paren in your if() statement:

<?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!";
}
adfaklsdjf
  • 250
  • 1
  • 11