Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Mar 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy how to handle T_CONSTANT_ENCAPSED_STRING error

    <?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

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,679
    Thanks
    25
    Thanked 656 Times in 655 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?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •