SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Apr 2006
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Parse error: syntax error, unexpected T_STRING

    i get this error

    Parse error: syntax error, unexpected T_STRING in C:\Program Files\xampp\htdocs\login\login.php on line 18

    when loging in
    please help me
    heses the code

    PHP Code:
    <?php

    //Database Information

    $dbhost "localhost";
    $dbname "password";
    $dbuser "admin";

    //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 users where username=’$username’ and password=’$password’”;


    $result mysql_query($query);

    if (
    mysql_num_rows($result) != 1) {
    $error “Bad Login”;
    include 
    “login.html”;

    } else {
    $_SESSION[‘username’] = “$username”;
    include 
    “memberspage.php”;
    }

    ?>

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,140
    Mentioned
    190 Post(s)
    Tagged
    2 Thread(s)

    T String

    This is a PHP error. By the looks of your quotes, it looks like you're NOT using a plain-text editor, but maybe something like word. Look in your post. See how the "and" is a different color? the parser is expecting a semi-colon in that line and since it's not there you get an "unexpected string" error. I don't think this is an error in your code (well, maybe), but is a result of using the wrong text editor to write your code with.

  3. #3
    SitePoint Wizard
    Join Date
    Jul 2003
    Location
    Kent
    Posts
    1,921
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    At several places your single quotes and double quotes are "matched pairs" angled left and right, instead of simple quotes as produced in a plain text editor. look at these "..." and '...' - see the difference? These are probably confusing the PHP engine into seeing strings, as suggested above.

  4. #4
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this is the same thing as in your other post.

    http://www.sitepoint.com/forums/showthread.php?t=374148


    fix your quotes. i dont know how many times you need to be told.


Bookmarks

Posting Permissions

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