...

View Full Version : how to handle T_CONSTANT_ENCAPSED_STRING error



noop123
03-03-2012, 02:38 PM
<?php
session_start();
$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']) : '';
if(isset($_POST['submit']))
{
$query = "SELECT username FROM login WHERE username = '$username' AND password = '$password'";
$result = mysql_query($query,$db) or die(mysql_error($db));
if(mysql_num_rows($result)>0)
{
$_SESSION['username'] = $username;
$_SESSION['logged'] = 1;
echo "<p>authenticated user<a href=n4.php>click here to generate reports</a></p>";
}
else
{
$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!!
with regards:)

sunfighter
03-03-2012, 05:26 PM
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?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum