Forum Moderators: coopster

Message Too Old, No Replies

Parse error:syntax error, unexpected T STRING in C:\ on line 38

Help

         

tsiwu

9:27 am on Nov 21, 2008 (gmt 0)

10+ Year Member



Hey everyone i seriously need your help, im a novice when it comes to PHP and MySQL. I'm developing a website using PHP and Mysql and i keep on getting this error(Parse error:syntax error, unexpected T_STRING in C:\ on line 38) when i'm trying to connect from signin.html to signin.php.What puzzles me is that there is no line 38. Please tell me what im doing wrong!

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]

enigma1

11:28 am on Nov 21, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You could try commenting out the include statements and see if the error persists.

Anyango

12:28 pm on Nov 21, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld tsiwu!

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]