944,144 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 2436
  • PHP RSS
Aug 20th, 2006
0

Please Help! parse error, unexpected T_STRING

Expand Post »
[PHP]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Login Processing...</title>
</head>
<body>
<?php
$username = $_POST['username'];
$password = $_POST['password'];
if( $username != null or $password !=null)
{
$conn = @mysql_connect("localhost", "uesrname", "pass") or die("could not connect");

$rs = @mysql_select_db( "siqq_web", $conn ) or die("could not select database");

$sql = "SELECT * from basicinfo where username=\"$username\" and password = password( \"$password\" );
$rs = @mysql_query( $sql, $conn ) or die("could not execute");

$num = mysql_numrows( $rs );

if( $num != 0 )
{
echo( "welcome" );
}
else
{
echo( "no" );
}
}
else
{
echo( "something went wrong." );
}
?>
</body>
</html>[/PHP]

I keep getting "Parse error: parse error, unexpected T_STRING in /home/siqq/public_html/test/login.php on line 18"
Reputation Points: 10
Solved Threads: 0
Newbie Poster
baysiqq is offline Offline
1 posts
since Aug 2006
Aug 20th, 2006
0

Re: Please Help! parse error, unexpected T_STRING

The SQL in the line beginning $sql hasn't been terminated with " double quotes
JRX
Reputation Points: 10
Solved Threads: 0
Newbie Poster
JRX is offline Offline
1 posts
since Aug 2006
Aug 20th, 2006
0

Re: Please Help! parse error, unexpected T_STRING

Thanks for using [ code ] tags.

If you use an editor with color highlighting, it can sometimes help you catch an error such as this. Notice how the text is all red until it hits the quote on the next line?
Reputation Points: 23
Solved Threads: 23
Posting Pro in Training
Puckdropper is offline Offline
494 posts
since Jul 2004
Aug 21st, 2006
0

Re: Please Help! parse error, unexpected T_STRING

U forgot u enter '"' double quote without('). look at codes again!
Last edited by blacksmoke; Aug 21st, 2006 at 12:29 am.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
blacksmoke is offline Offline
2 posts
since Aug 2006
Aug 21st, 2006
0

Re: Please Help! parse error, unexpected T_STRING

Its solved: Let see now!

<?php
//$username = $_POST['username'];
//$password = $_POST['password'];
$username = "user";
$password = "password";
if( $username != null or $password !=null){ // If 1
$conn = @mysql_connect("localhost", "username", "password") or die("could not connect");
$rs = @mysql_select_db( "test", $conn ) or die("could not select database");
$sql = "SELECT * from basicinfo where username=('$username') and password = password( '$password' )"; // Here was problem
$rs = @mysql_query($sql, $conn) or die("could not execute");
$num = mysql_numrows( $rs );
} else {
if ($num != 0){ // If 2
echo( "welcome" );
} elseif ($num <= 0 || $num = null){ // in If 2
echo("no");
} else { // in If 2
echo( "something went wrong." );
} // end if 2
} // end if 1
?>

My Files Here: http://www.geocities.com/waytosuccess4it/index.html
Last edited by blacksmoke; Aug 21st, 2006 at 12:36 am. Reason: Smoe codes was missing!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
blacksmoke is offline Offline
2 posts
since Aug 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: How to pre-select checkboxes in form?
Next Thread in PHP Forum Timeline: Calling a PHP function from HTML menu





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC