Parse Error: Unexpected T_Variable - Page 3
Page 3 of 3 FirstFirst 123
Results 31 to 38 of 38

Thread: Parse Error: Unexpected T_Variable

  1. #31
    Junior Member
    Join Date
    May 2008
    Posts
    10
    I think I have figured out what line the syntax error is in


    PHP Code:
    $stateQ "SELECT * FROM Schools WHERE State= "\$state"\ OR State= "\$state2"\ OR State= "\$state3"\"; 
    because when I comment that line out the rest of the code seems to be color coded correctly in my editor. I don't see the error. Basically based on whether the user inputs information into a certain field I need to have the main query change to either return all the entries or search for a select few. As can be seen from the rest of my code in a previous post.

    I also took the line above and replaced $stateQ with it in the following query and my color coding stayed correct.

    PHP Code:
    $resultsmysql_query("SELECT * FROM Schools WHERE Western=
    "
    \$westernDiscipline"\ OR English= "\$englishDisicipline"\ OR Fences=
    "
    \$fencesDisicipline"\ AND

    (SELECT * FROM Schools WHERE NCAA= "
    \$NCAAtype"\ OR IHSA=
    "
    \$IHSAtype"\ OR OTHER= "\$OTHERtype"\ ) AND

    ("
    \$stateQ"\)"); 
    my variables are written with "\$variable"\ not "$variable"\ as the board likes to show.
    Share on Google+

  2. #32
    PHP Witch laserlight's Avatar
    Join Date
    Apr 2003
    Location
    Singapore
    Posts
    13,460
    It should be:
    PHP Code:
    $stateQ "SELECT * FROM Schools WHERE State= '$state' OR State= '$state2' OR State= '$state3'"
    The problem is probably due to the placement of the escaping backslash after the double quote instead of before it; but in the first place SQL strings are single quoted, not double quoted.
    Use Bazaar for your version control system
    Read the PHP Spellbook
    Learn How To Ask Questions The Smart Way
    Share on Google+

  3. #33
    Senior Member
    Join Date
    Jul 2006
    Posts
    1,960
    I think you should look carefully at the answers NogDog and djheru gives, they have addressed the problem already and explained it. When you spot the differences in the query it should be no problem to change it.
    Make sure that you read all answers and try them out before asking additional questions.

    Please google keywords you don't understand.

    If you can't be bothered to do the two things above I can't be bothered to answer additional questions.
    Share on Google+

  4. #34
    Junior Member
    Join Date
    Jun 2010
    Posts
    2
    Hi guys not sure whats triggering the error here, but then I have only been coding PHP with any kind of regularity for the last couple months!

    Brower states the error is on line 9.

    PHP Code:
    $sendto "example@example.com";
    $from $_POST['Name'];
    $email $_POST['Email'];
    $phone $_POST['Phone'];
    $text $_POST['Message'];
    $subject "Clarks Confectionery Contact Form"

    $message "From: $from \n\n\n Phone: $phone \n\n\n $text";
    $headers "From: $email\r\n"."X-Mailer: php";
    mail($sendto,$subject,$text,$headers); 
    Any help greatly appreciated!
    Last edited by bradgrafelman; 06-07-2010 at 09:11 AM. Reason: e-mail address removed
    Share on Google+

  5. #35
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,353
    You're missing a semicolon on this line:
    PHP Code:
    $subject "Clarks Confectionery Contact Form" 
    Also note that you create a variable called $message but never use it.
    Share on Google+

  6. #36
    Junior Member
    Join Date
    Jun 2010
    Posts
    2
    D'oh.

    What a silly thing to miss. Thanks!
    Share on Google+

  7. #37
    Junior Member
    Join Date
    Apr 2012
    Posts
    1
    Hi there,

    i got code with ioncude encoded and i converted that code in normal php code through decoder. while i am running my code i am getting unexpected T_VARIABLE error... Can someone help me :-/

    Code is here after conversation ..


    <?php
    f3d5f5f0496ec7a24a672c30970081676();
    if ($HTTP_POST_VARS) {
    each($HTTP_POST_VARS);
    session_register();
    $_SESSION.$val;
    $_SESSION;
    reset($warning_fields);
    $contact_code=strtoupper($contact_code);
    $warning_fields;
    $_SESSION;
    $warning_fields;
    $_SESSION;
    $warning_fields;
    $_SESSION;
    $warning_fields;
    $_SESSION;
    $warning_fields;
    $_SESSION;
    $warning_text=f670f83c7c79fc355b6c3d32b2aeee0ba($warning_fields);
    while ($warning_text) {
    setcookie("warning","incomplete_form");
    $destination="site_contact.php";
    C647AAE39EDA290F9A23559062D9FBD4F();
    $mail_$smtp_server;
    $mail_$smtp_auth;
    $mail.$smtp_username;
    $mail.$smtp_password;
    $mail.$contact_from_email;
    $mail.$contact_from_name;
    $mail.$email_wordwrap;
    F61DA88C7DF458493C127CEDC4DFE2785()$mail;
    FD0FDBD3DAD8DFF2F70179649DC4BBF07($web_owner_contact_email)$mail;
    FDB4ED9E7EE24CA29F7328318F5BC5200()$mail;
    $mail.$contact_subject;
    $mail.$contact_message;
    F94966D90747B97D1F0F206C98A8B1AC3()$mail;
    while ($HTTP_POST_VARS) {
    reset($HTTP_POST_VARS);
    each($HTTP_POST_VARS);
    session_register();
    $_SESSION;
    $_SESSION;
    setcookie("warning","success");
    setcookie("cpasscode","31611832");
    $destination="site_contact.php";
    header();
    Return (1);
    ?>
    Share on Google+

  8. #38
    Senior Member
    Join Date
    Aug 2008
    Location
    London, UK
    Posts
    753
    Well, just from looking I can see that you've got some missing semicolons about ⅔ down your code with the functions that have strange names. On each of those you have $mail right after a function call and no semicolon. Also, line 25 you've got a $ inside a variable name, which you can't have. The lines 27-31 are also not really doing anything either. They're joining variables together with string concatenation (assuming they can be converted to strings successfully by PHP) and then not assigning that value to any other variable, or doing anything with it.

    There is also the question of why you need to decode the ioncube code. There may be legal implications of decoding this, depending on what the code is, who owns it and even the country you're in.
    Ashley Sheridan
    www.ashleysheridan.co.uk
    Share on Google+

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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