Parse error: parse error, unexpected T_STRING in on line 21

21 = $query = “select * from users where username=’$username’ and password=’$password’”;

mysql_select_db("$dbname", $connection);

session_start();
$username = $_POST[‘username’];
$password = md5($_POST[‘password’]);

$query = “select * from users where username=’$username’ and password=’$password’”;

$result = mysql_query($query);

if (mysql_num_rows($result) != 1) {
$error = “Bad Login”;
include “login.html”;

} else {
$_SESSION[‘username’] = “$username”;
include “memberspage.php”;
}

?>

Thanks in Advance.

Recommended Answers

All 2 Replies

$query = "select * from users where username='$username' and password='$password'";

replace your (”) with (") and (’) with (').

hi vietnow,

just remove single quotes around $username and $password.

other wise replace single quotes with " and followed by a .

both are fine

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.