Forum Moderators: coopster
Here is my code:
[code]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>signin in</title>
</head>
<body>
<?php //Database Information
$dbhost = "localhost";
$dbname = "musicwebsite";
$dbuser = "root";
$dbpass = "#*$!xx";
//Connect to database
mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
mysql_select_db($dbname) or die(mysql_error());
session_start();
$username = $_POST[‘username’];
$password = md5($_POST[‘password’]);
$query = “select * from signin where username=’$username’ and password=’$password’”;
$result = mysql_query($query);
if (mysql_num_rows($result) != 1) {
$error = “Bad Login”;
include “signin.html”;
} else {
$_SESSION[‘username’] = “$username”;
include “memberspage.php”;
}
?>
</body>
</html>
[\code]
I noticed the most of the quotation marks are not what they should be, is that same in your code ? or its just a copy paste issue ?
For example
“ should be "
and
’ should be '
If you fix them, it should work and the parse error should go away. If it doesn't then look for the same error in your include files.
Heres the code with fixed quotation marks anyway
<?php //Database Information
$dbhost = "localhost";
$dbname = "musicwebsite";
$dbuser = "root";
$dbpass = "#*$!xx";
mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
mysql_select_db($dbname) or die(mysql_error());
session_start();
$username = $_POST['username'];
$password = md5($_POST['password']);
$query = "select * from signin where username='$username' and password='$password'";
$result = mysql_query($query);
if (mysql_num_rows($result) != 1) {
$error = "Bad Login";
include "signin.html";
} else {
$_SESSION['username'] = "$username";
include "memberspage.php";
}
?>
[edited by: Anyango at 12:29 pm (utc) on Nov. 21, 2008]