Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
03-03-2012, 01:38 PM #1
- Join Date
- Mar 2012
- Thanked 0 Times in 0 Posts
how to handle T_CONSTANT_ENCAPSED_STRING error
$db = mysql_connect('localhost','root','') or die('unable to connect ');
mysql_select_db('user', $db) or die($db);
$username = (isset($_POST['username'])) ? trim($_POST['username']) : '';
$password = (isset($_POST['password'])) ? trim($_POST['password']) : '';
$query = "SELECT username FROM login WHERE username = '$username' AND password = '$password'";
$result = mysql_query($query,$db) or die(mysql_error($db));
$_SESSION['username'] = $username;
$_SESSION['logged'] = 1;
echo "<p>authenticated user<a href=n4.php>click here to generate reports</a></p>";
$error = "<p>you have supplied an invalid username or password.please<a href=n2.html>click here to login again</a></p>";
i am getting error ( ! ) Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in C:\wamp\www\myp\n3.php on line 9.
please help me out!!
03-03-2012, 04:26 PM #2
- Join Date
- Jan 2011
- Thanked 748 Times in 746 Posts
T_CONSTANT_ENCAPSED_STRING normally means you wrote your string wrong, but I did not get that error and it's easy to check .
I echoed the $query (line 9) and it looks good to me. Also looked at the line before and after line 9.
Are you still getting this error?