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 3 of 3
  1. #1
    New Coder
    Join Date
    Jul 2009
    Posts
    21
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Syntax Error. (unexpected T_VARIABLE)

    Hello,

    The error i get is
    Code:
    Parse error: syntax error, unexpected T_VARIABLE in /home/assassin/domains/realdutchserver.nl/public_html/webformysql/pstats.php on line 7
    And Line 7 is
    PHP Code:
    $Query 'SELECT Level, Money, Kills, Admin, Drugs, Number, Exp, Vip, Team FROM users WHERE name = \'' $nick '\''// With this query we get the information from $nick to transform it into a picture, where Kills Deaths etc are the names of the fields 
    And can someone tell me what a T_VARIABLE is?

    Thanks In Advance,
    Greets,
    Mujib
    Last edited by Mujib; 10-22-2009 at 08:39 PM. Reason: Extra Question

  • #2
    Regular Coder godofreality's Avatar
    Join Date
    Jan 2009
    Posts
    234
    Thanks
    1
    Thanked 15 Times in 15 Posts
    change this
    PHP Code:
    $Query 'SELECT Level, Money, Kills, Admin, Drugs, Number, Exp, Vip, Team FROM users WHERE name = \'' $nick '\''
    to this
    PHP Code:
    $Query mysql_query("SELECT * FROM `users` WHERE `name` = '$nick'");
    $row mysql_fetch_assoc($Query);
    $row['Level']; //user's level
    $row['Money']; //user's money
    $row['Kills']; //user's kills etc etc etc 
    so the format to use this data will be $row['(the column name you wish to view)']

  • #3
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    Quote Originally Posted by godofreality View Post
    change this
    PHP Code:
    $Query 'SELECT Level, Money, Kills, Admin, Drugs, Number, Exp, Vip, Team FROM users WHERE name = \'' $nick '\''
    to this
    PHP Code:
    $Query mysql_query("SELECT * FROM `users` WHERE `name` = '$nick'");
    $row mysql_fetch_assoc($Query);
    $row['Level']; //user's level
    $row['Money']; //user's money
    $row['Kills']; //user's kills etc etc etc 
    so the format to use this data will be $row['(the column name you wish to view)']
    That is bad advice period, not to mention it does nothing to address the OP's problem. It is always better to specify the columns you want in a query. That way if you add additional columns later or don't actually need all the columns, you aren't wasting resources getting data you aren't going to use.

    As far as the actual problem, look on line 6, are you missing a semicolon? Or a bracket? As the error says it is a syntax error and usually it means there is a problem on the line of code before whatever line it reports.
    OracleGuy


  •  

    Posting Permissions

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