Parse error syntax error unexpected t_variable

parse error syntax error unexpected t_variable

This means that you have a syntax error in your PHP code. Of course in code, there is a certain order in which pieces of code may be placed. Parse error: syntax error, unexpected T_VARIABLE on line 1? Hi all, I've to devellop a website for a training and I got a problem on one of my. The problem was that the loop is contained in the HTML code. Normally, it's not a problem, but the PHP parser has been offended and decided to not play ball. parse error syntax error unexpected t_variable

Related Videos

Parse error syntax error, unexpected '' T ENCAPSED AND WHITESPACE, expecting ' ' in php:(Fixed)

Parse error syntax error unexpected t_variable - something

解析錯誤:語法錯誤,第 192 行 /functions.php 中的意外 T_VARIABLE (Parse error: syntax error, unexpected T_VARIABLE in /functions.php on line 192)

問題描述

解析錯誤:語法錯誤,第 192 行 /functions.php 中的意外 T_VARIABLE (Parse error: syntax error, unexpected T_VARIABLE in /functions.php on line 192)

I have, since last morning, the following error showing up on my website hosted through godaddy.com with WP 3.2.1. I now know that the site was hacked. I don't have access to the WP admin CP since it also comes with the same error:

  

Parse error: syntax error, unexpected T_VARIABLE in /home/content/xx/xxxxx/html/websites/xxxxxxxx/wp‑includes/functions.php on line 192

And this is the line of code in the php file:

Any one can help?

this is the whole block:

‑‑‑‑‑

參考解法

方法 1:

The line before is:

Obviously, the line is not complete, hence the parse error.

(by user1978137、Madara's Ghost)

參考文件

  1. Parse error: syntax error, unexpected T_VARIABLE in /functions.php on line 192 (CC BY‑SA 3.0/4.0)

Read these next...

I'm new to PHP, but I seriously can't see anything wrong with the code here.

This is to import a list of user data into a table in a db.

[quote]

<?php

$importfile="members.csv" or die(mysql_error());
$escape=",";

// we start the database connection
$username="aaaaa";
$password="bbbbbb";
$database="ccccccc";

mysql_connect(localhost,$username,$password) or die(mysql_error());
$db=mysql_select_db($database);
$import=file($importfile);

//remove the first line (description of user data)
array_shift($import);

//now loop all lines and insert the members
foreach($import as $lines)
{
//explode the lines
$users=explode($escape,$lines);
//generate the dateRegistered
$regdate=mktime();

//Now insert the new user
mysql_query("
      INSERT IGNORE INTO members
         (memberName, ID_GROUP, realName , passwd, dateRegistered, emailAddress, websiteTitle, websiteUrl)
      VALUES ('$users[1]', '0', '$users[0]' , '" . sha1(strtolower($users[2]) . "','$regdate', '$users[8]', '$users[5]', '$users[10]')");
}
mysql_close();
echo 'IMPORT COMPLETE!';
?>

[/quote]

{
//explode the lines
$users=explode($escape,$lines);
//generate the dateRegistered
$regdate=mktime();

//Now insert the new user
mysql_query("
      INSERT IGNORE INTO {$db_prefix}members
         (memberName, ID_GROUP, realName , passwd, dateRegistered, emailAddress, websiteTitle, websiteUrl)
      VALUES ('$users[1]', '0', '$users[0]' , '" . sha1(strtolower($users[2]) . "','$regdate', '$users[8]', '$users[5]', '$users[10]')");
}
mysql_close();
echo 'IMPORT COMPLETE!';
?>

[/quote]

No matter WHAT I do I get an error referring to the foreach() line stating "Parse error: syntax error, unexpected T_VARIABLE". No matter what I do to correct it it doesn't change. Heck, if I even try to break it by specifying a nonexistant file to import I still get the same error.

Any thoughts?

checkBest Answer

  • Sometimes I have had to go through the code an retype all semi-colons, commas, and/or quotation marks.  I don't know why, but sometimes it helps.  You may also want to replace the double-quotes with single-quotes when assigning your variables at the beginning.

  • View Best Answer in replies below
    • Just out of curiosity, does your .csv file have a CR/LF at the end? Remembering back to my asp.net days, this can sometimes cause problems as it tries to import data that doesn't exist.

      May not be the problem but it's as good a place to start as any.

    • Hm... well it did, but that wasn't it.

    • I've had this before. It's punctuation. Check your quotes and semicolons in the line that generates the error or the line before the line number reported. You should be getting a line number with your error code.

    • Needs moar bracket I think....

      I don't see a lot wrong with the code except the sha1(strtolower($users[2])  is missing a closing bracket at the end of it...  should read

      foreach($import as $lines)
      {
      //explode the lines
      $users=explode($escape,$lines);
      //generate the dateRegistered
      $regdate=mktime();

      //Now insert the new user
      mysql_query("
      INSERT IGNORE INTO members
      (memberName, ID_GROUP, realName , passwd, dateRegistered, emailAddress, websiteTitle, websiteUrl)
      VALUES ('$users[1]', '0', '$users[0]' , '" . sha1(strtolower($users[2])) . "','$regdate', '$users[8]', '$users[5]', '$users[10]')");
      }


      As a side-note, I strongly recommend a code highlighting editor like Notepad++, it's fantastic, sit your cursor next to a bracket and it shows you its partner ;P

      I'm not sure if that'll solve the error, it's all I spotted though.

      Aside from that...  maybe stick a semicolon on the end of the foreach? It's a bit anal and not really necessary, I've recently come to the opinion it makes for prettier code if you leave the semicolons off the ends of conditional clauses...

    • Ah, the old missing closing bracket. Forgot to look for that.

    • Kinda late to the party, but looks like you're missing a closing parenthesis on shal(stringtolower($users[2])).

      Also, it's possible that PHP doesn't like that query broken up on multiple lines like you have it.  Either stuff it all into one line or do something like this:

      //Now insert the new user
      $insertQuery = "INSERT IGNORE INTO members ";
      $insertQuery .= "(memberName, ID_GROUP, realName , passwd, dateRegistered, emailAddress, websiteTitle, websiteUrl) ";
      $insertQuery .= "VALUES ('$users[1]', '0', '$users[0]' , '" . sha1(strtolower($users[2])) . "','$regdate', '$users[8]', '$users[5]', '$users[10]')";
      mysql_query($insertQuery);

    • Still no change in the error I'm afraid. On the bright side, nobody's late to the party yet. :)

      While there was indeed a missing bracket on the sha1 function (good catch) it's erroring out well before it even parses that line. In fact I've even taken out the entire "insert" section to verify it.

      The error is referring to the foreach line, specifically stating "Parse error: syntax error, unexpected T_VARIABLE in /path/import.php on line 22". I don't see anything weird before or after it and adding a semicolon didn't help either.

      Thanks for the help, it's sucking hours of my life away.

    • Hmmm... weird indeed!  Line 22 for you corresponds to the explode()?  I'm beginning to wonder if there's a formatting issue with your CSV file - strange characters that breaks the explode?  I'm able to execute the following script without any errors at all (using a simple, text-only dummy import file):

      <?php

      $importfile="members.csv" or die(mysql_error());
      $escape=",";

      // we start the database connection
      $username="root";
      $password="smahoi";
      $database="leon2010test";

      mysql_connect(localhost,$username,$password) or die(mysql_error());
      $db=mysql_select_db($database);
      $import=file($importfile);

      //remove the first line (description of user data)
      array_shift($import);

      //now loop all lines and insert the members
      foreach($import as $lines)
      {
       //explode the lines
       $users=explode($escape,$lines);
       //generate the dateRegistered
       $regdate=mktime();

       //Now insert the new user
       mysql_query("INSERT IGNORE INTO members (memberName, ID_GROUP, realName , passwd, dateRegistered, emailAddress, websiteTitle, websiteUrl) VALUES ('$users[1]', '0', '$users[0]' , '" . sha1(strtolower($users[2])) . "','$regdate', '$users[8]', '$users[5]', '$users[10]')");
      }
      mysql_close();
      echo 'IMPORT COMPLETE!';
      ?>

    • I'm not sure about the syntax for

      VALUES ('$users[1]', '0', '$users[0]' , '" . sha1(strtolower($users[2]) . "','$regdate', '$users[8]', '$users[5]', '$users[10]')");

      because of the embedded functions.  Try setting something like  

      $passwd =  sha1(strtolower($users[2]));

      and then change the VALUES to read:

      VALUES ('$users[1]', '0', '$users[0]' , '$passwd', '$regdate', '$users[8]', '$users[5]', '$users[10]')");

      and see if that helps.

      Or, use curly braces in the line so PHP processes the value first:

      VALUES ('$users[1]', '0', '$users[0]' , "{sha1(strtolower($users[2]))}', '$regdate', '$users[8]', '$users[5]', '$users[10]')");

      Hope this helps (since I haven't actually tried to run any of this...)


    • No, it's definitely the foreach line where the error occurs. As a test I emptied out the entire foreach loop (so basically foreach($import as $lines) { } ) and it still generates the same error.

      I created the CSV using Excel and did a "Save As...CSV" so I can't see where that would go wrong. I tried a new CSV with just 5 lines, verfying there are no empty cells... but no change.

      Another experiment: I added echo "IMPORT START"; at the very begining of the file and now it errors out on that! Seriously WTF? Is there something weird about my PHP config? My encoding???

    • I'd say your encoding - what editor are you using to write the script?  Make sure it's outputting UTF-8.

    • Have you tried removing or die(mysql_error()) from the $importfile definition?  That might be causing it confusion.

    • Actually I added the die(mysql_error()) in the hopes of generating some new errors, but it didn't do anything. I can't seem to figure out how to debug this since even the "echo" commands aren't working. Maybe I should start over with a new file one line at a time. Oh brother...

      I use either Notepad++ or Dreamweaver to edit them based on my mood. The current format is UTF-8 without BOM. Same for the CSV.

    • Sometimes I have had to go through the code an retype all semi-colons, commas, and/or quotation marks.  I don't know why, but sometimes it helps.  You may also want to replace the double-quotes with single-quotes when assigning your variables at the beginning.

    • Problem SOLVED. Man that feels good.

      Dimhelmet was the closest. I retyped some of the lines (previously was copy/paste from the internet) and those line magically started working. Go figure.

      Thanks to all who helped!

    • Try using Netbeans for PHP development. It will check your code for you.

    • Spark! Pro series - 1st September 2022

      Spark! Pro series - 1st September 2022

      Spiceworks Originals

      Today in History: Wreck of the Titanic Found Seventy-three years after it sank to the North Atlantic ocean floor, a joint U.S.-French expedition locates the wreck of the RMS Titanic. The sunken liner was about 400 miles east of Newfoundland in the ...

    • SpiceQuest September (2022) -- Of Bacon and Books... and Bacon

      SpiceQuest September (2022) -- Of Bacon and Books... and Bacon

      Spiceworks Originals

      Welcome to another SpiceQuest! In this series, we call out current holidays and give you the chance to earn the monthly SpiceQuest badge! (Each task can be done at any time. They don't have to be completed on a certain holiday.) This month w...

    • Art Imitates Life: DALL·E 2 AI Generates Art Featuring IT Professionals

      Art Imitates Life: DALL·E 2 AI Generates Art Featuring IT Professionals

      Water Cooler

      In my last post about computer generated art, I tested artificial intelligence's ability to create orange T-Rex art in the style of many famous artists, using OpenAI's DALL·E 2 AI.Quick recap of how DALL·E 2 works. Users can request images of anything by ...

    • Snap! Azure outage, malware in JWST images, floppy disks, Voyager 1, & more

      Snap! Azure outage, malware in JWST images, floppy disks, Voyager 1, & more

      Spiceworks Originals

      Your daily dose of tech news, in brief. While the month may be ending, we're halfway through the week. Let's jump into today's Snap! and see some of the things going on in the world. You need to hear this. Microsoft Azure outage knocks Ubuntu...

    • Monitor our Weblogs

      Monitor our Weblogs

      Security

      Hi,I would like to ask for your recommendations on how I can capture the websites our end users access during office hours.our current firewall doesnt support it as it only logs HTTP connections and we all know that almost all of the websites now are usin...

    The Parse error: syntax error, unexpected T_VARIABLE means that PHP was not expecting a variable at any given time.

    This error can occur in some situations, but your question includes some special cases.

    The most common problem is the absence of a comma point in the previous line. The interpreter in this case informed the error in the next line that occurs, and not in the line where the semicolon is missing:

    Returns the error:

    Parse error: syntax error, unexpected '$ var2' (T_VARIABLE) in path / file on line 4

    Another problem is in the definition of the word before the variable in a context outside of a class.

    This keyword was used in PHP 4 to define class properties, and currently exists only to maintain comparability with old codes.

    In recent versions, it is a synonym for .

    Simply remove when defining variables in PHP.

    Now, if you are setting to a class property, the problem is that it is not possible to define dynamic values directly in the class definition (basically variables or functions), such as be noted in the documentation .

    This explains why works.

    Recommendations

  • See if the line above the one entered in the error ends with

  • Do not use in PHP 5 onwards, prefer , or .

  • If you need to define dynamic values in the class property, you can do this by the constructor method:

  • Parse error: syntax error, unexpected (T_VARIABLE), expecting ',' or ')'

    Did you look at the way the forum highlighted your code? The variables you placed in the SQL statement are not the same color as the SQL statement itself. You’re using the double quote both as the string delimiter in PHP as well as the string delimiter in the SQL statement, so PHP is thinks it’s PHP code.

    The quick fix could be to (note the difference in colors compared to your code):

    But ideally, you should not create SQL queries this way at all. Just dumping unfiltered form input in your SQL query is a great way to get your database hacked, because it leaves you wide open to SQL Injection Attacks. You should either validate or sanitize the input variables, or use parameterized statements to separate the data from the queries.

    Also, to save you from having to write more follow-up messages:

    • The database credentials you are using are not correct. Check the MySQL Databases in the control panel instead.
    • The is not valid. It should be instead.

    1 Like

    The Parse error: syntax error, unexpected T_VARIABLE means that PHP was not expecting a variable at any given time.

    This error can occur in some situations, but your question includes some special cases.

    The most common problem is the absence of a comma point in the previous line. The interpreter in this case informed the error in the next line that occurs, and not in the line where the semicolon is missing:

    Returns the error:

    Parse error: syntax error, unexpected '$ var2' (T_VARIABLE) in path / file on line 4

    Another problem is in the definition of the word before the variable in a context outside of a class.

    This keyword was used in PHP 4 to define class properties, and currently exists only to maintain comparability with old codes. parse error syntax error unexpected t_variable In recent versions, it is a synonym for .

    Simply remove when defining variables in PHP.

    Now, if you are setting to a class property, the problem is that it is not possible to define dynamic values directly in the class definition (basically variables or functions), such as be noted in the documentation.

    This explains why works.

    Recommendations

  • See if the line above the one entered in the error ends with

  • Do not use in PHP 5 onwards, parse error syntax error unexpected t_variable or .

  • If you need to define dynamic values in the class property, you can do this by the constructor method:

  • Read these next.

    I'm new to PHP, but I seriously can't see anything wrong with the code here.

    This is to import a list of user data into a table in a db.

    [quote]

    <?php

    $importfile="members.csv" or die(mysql_error());
    $escape=",";

    // we start the database connection
    $username="aaaaa";
    $password="bbbbbb";
    $database="ccccccc";

    mysql_connect(localhost,$username,$password) or die(mysql_error());
    $db=mysql_select_db($database);
    $import=file($importfile);

    //remove the first line (description of user data)
    array_shift($import);

    //now loop all lines and insert the members
    foreach($import as $lines)
    {
    //explode the lines
    $users=explode($escape,$lines);
    //generate the dateRegistered
    $regdate=mktime();

    //Now insert the new user
    mysql_query("
          INSERT IGNORE INTO members
             (memberName, ID_GROUP, realName , passwd, dateRegistered, emailAddress, websiteTitle, websiteUrl)
          VALUES ('$users[1]', '0', '$users[0]' , '" . sha1(strtolower($users[2]) . "','$regdate', '$users[8]', '$users[5]', '$users[10]')");
    }
    mysql_close();
    echo 'IMPORT COMPLETE!';
    ?>

    [/quote]

    {
    //explode the lines
    $users=explode($escape,$lines);
    //generate the dateRegistered
    $regdate=mktime();

    //Now insert the new user
    mysql_query("
          INSERT IGNORE INTO {$db_prefix}members
             (memberName, ID_GROUP, realName , passwd, dateRegistered, emailAddress, websiteTitle, websiteUrl)
          VALUES ('$users[1]', '0', '$users[0]' , '" . sha1(strtolower($users[2]) . "','$regdate', '$users[8]', '$users[5]', '$users[10]')");
    }
    mysql_close();
    echo 'IMPORT COMPLETE!';
    ?>

    [/quote]

    No matter WHAT I do I get an error referring to the foreach() line stating "Parse error: syntax error, unexpected T_VARIABLE". No matter what I do to correct it it doesn't change. Heck, parse error syntax error unexpected t_variable, if I even try to break it by specifying a nonexistant file to import I still get the same error.

    Any thoughts?

    checkBest Answer

  • Sometimes I have had to go through the code an retype all semi-colons, commas, and/or quotation marks.  I don't know why, but sometimes it helps.  You may also want to replace the double-quotes with single-quotes when assigning your variables at the beginning.

  • View Best Answer in replies below
    • Just out of curiosity, does your .csv file have a CR/LF at the end? Remembering back to my asp.net days, this can sometimes cause problems as it tries to import data that doesn't exist.

      May not be the problem but it's as good a place to start as any.

    • Hm. well it did, but that wasn't it.

    • I've had this before. It's punctuation. Check your quotes and semicolons in the line that generates the error or the line before the line number reported. You should be getting a line number with your error code.

    • Needs moar bracket I think.

      I don't see a lot wrong with the code except the sha1(strtolower($users[2])  is missing a closing bracket at the end of it.  should read

      foreach($import as $lines)
      {
      //explode the lines
      $users=explode($escape,$lines);
      //generate the dateRegistered
      $regdate=mktime();

      //Now insert the new user
      mysql_query("
      INSERT IGNORE INTO members
      (memberName, ID_GROUP, realNamepasswd, dateRegistered, emailAddress, websiteTitle, websiteUrl)
      VALUES ('$users[1]', '0', '$users[0]''". sha1(strtolower($users[2])). "','$regdate', '$users[8]', '$users[5]', '$users[10]')");
      }


      As a side-note, I strongly recommend a code highlighting editor like Notepad++, it's fantastic, sit your cursor next to a bracket and it shows you its partner ;P

      I'm not sure if that'll solve the error, it's all I spotted though.

      Aside from that.  maybe stick a semicolon on the end of the foreach? It's a bit anal and not really necessary, I've recently come to the opinion it makes for prettier code if you leave the semicolons off the ends of conditional clauses.

    • Ah, the old missing closing bracket. Forgot to look for that.

    • Kinda late to the party, but looks like you're missing a closing parenthesis on shal(stringtolower($users[2])).

      Also, it's possible that PHP doesn't like that query broken up on multiple lines like you have it.  Either stuff it all into one line or do something like this:

      //Now insert the new user
      $insertQuery = "INSERT IGNORE INTO members ";
      $insertQuery .= "(memberName, ID_GROUP, realNamepasswd, parse error syntax error unexpected t_variable, dateRegistered, emailAddress, websiteTitle, websiteUrl) ";
      $insertQuery .= "VALUES ('$users[1]', '0', '$users[0]''". sha1(strtolower($users[2])). "','$regdate', '$users[8]', '$users[5]', '$users[10]')";
      mysql_query($insertQuery);

    • Still no change in the error I'm afraid. On the bright side, nobody's late to the party yet. :)

      While there was indeed a missing bracket on the sha1 function (good catch) it's erroring out well before it even parses that line. In fact I've even taken out the entire "insert" section to verify it.

      The error is referring to the foreach line, specifically stating "Parse error: syntax error, unexpected T_VARIABLE in /path/import.php on line 22". I don't see anything weird before or after it and adding a semicolon didn't help either.

      Thanks for the help, it's sucking hours of my life away.

    • Hmmm. weird indeed!  Line 22 for you corresponds to the explode()?  I'm beginning to wonder if there's a formatting issue with your CSV file - strange characters that breaks the explode?  I'm able to execute the following script without any errors at all (using a simple, parse error syntax error unexpected t_variable, text-only dummy import file):

      <?php

      $importfile="members.csv" or die(mysql_error());
      $escape=",";

      // we start the database connection
      $username="root";
      $password="smahoi";
      $database="leon2010test";

      mysql_connect(localhost,$username,$password) or die(mysql_error());
      $db=mysql_select_db($database);
      $import=file($importfile);

      //remove the first line (description of user data)
      array_shift($import);

      //now loop all lines and insert the members
      foreach($import as $lines)
      {
       //explode the lines
       $users=explode($escape,$lines);
       //generate the dateRegistered
       $regdate=mktime();

       //Now insert the new user
       mysql_query("INSERT IGNORE INTO members (memberName, ID_GROUP, realNamepasswd, dateRegistered, emailAddress, websiteTitle, websiteUrl) VALUES ('$users[1]', '0', '$users[0]''". sha1(strtolower($users[2])). "','$regdate', '$users[8]', '$users[5]', '$users[10]')");
      }
      mysql_close();
      echo 'IMPORT COMPLETE!';
      ?>

    • I'm not sure about the syntax for

      VALUES ('$users[1]', '0', '$users[0]''" . sha1(strtolower($users[2]) . "','$regdate', '$users[8]', '$users[5]', '$users[10]')");

      because of the embedded functions.  Try setting something like  

      $passwd =  sha1(strtolower($users[2]));

      and then change the VALUES to read:

      VALUES ('$users[1]', '0', '$users[0]''$passwd', parse error syntax error unexpected t_variable, '$regdate', '$users[8]', '$users[5]', '$users[10]')");

      and see if that helps.

      Or, use curly braces in the line so PHP processes the value first:

      VALUES ('$users[1]', '0', '$users[0]'"{sha1(strtolower($users[2]))}', '$regdate', '$users[8]', '$users[5]', '$users[10]')");

      Hope this helps (since I haven't actually tried to run any of this.)


    • No, it's definitely the foreach line where the error occurs. As a test I emptied out the entire foreach loop (so basically foreach($import parse error syntax error unexpected t_variable $lines) { } ) and it still generates the same error.

      I created the CSV using Excel and did a "Save As.CSV" so I can't see where that would go wrong. I tried a new CSV with just 5 lines, verfying there are no empty cells., parse error syntax error unexpected t_variable. but no change.

      Another experiment: I added echo "IMPORT START"; at the very begining of the file and now it errors out on that! Seriously WTF? Is there something weird about my PHP config? My encoding???

    • I'd say your encoding - what editor are you using to write the script?  Make sure it's outputting UTF-8.

    • Have you tried removing or die(mysql_error()) from the $importfile definition?  That might be causing it confusion.

    • Actually I added the die(mysql_error()) in the hopes of generating some new errors, but it didn't do anything. I can't seem to figure out how to debug this since even the "echo" commands aren't working. Maybe I should start over with a new file one line at a time. Oh brother.

      I parse error syntax error unexpected t_variable either Notepad++ or Dreamweaver to edit them based on my mood. The current format is UTF-8 without BOM. Same for the CSV.

    • Sometimes I have had to go through the code an retype all semi-colons, commas, and/or quotation marks.  I don't know why, but sometimes it helps.  You may also want to replace the double-quotes with single-quotes when assigning your variables at the beginning.

    • Problem SOLVED. Man that feels good.

      Dimhelmet was the closest. I retyped some of the lines (previously was copy/paste from the internet) and those line magically started working. Go figure.

      Thanks to all who helped!

    • Try using Netbeans for PHP development. It will check your code for you.

    • Spark! Pro series - 1st September 2022

      Spark! Pro series - 1st September 2022

      Spiceworks Originals

      Today in History: Wreck of the Titanic Found Seventy-three years after it sank to the North Atlantic ocean floor, a joint U.S.-French expedition locates the wreck of the RMS Titanic. The sunken liner was about 400 miles east of Newfoundland in the .

    • SpiceQuest September (2022) -- Of Bacon and Books. and Bacon

      SpiceQuest September (2022) -- Of Bacon and Books. and Bacon

      Spiceworks Originals

      Welcome to another SpiceQuest! In this series, we call out current holidays and give you the chance to earn the monthly SpiceQuest badge! (Each task can be done at any time. They don't have to be completed on a certain holiday.) This month w.

    • Art Imitates Life: DALL·E 2 AI Generates Art Featuring IT Professionals

      Art Imitates Life: DALL·E 2 AI Generates Art Featuring IT Professionals

      Water Cooler

      In my last post about computer generated art, I tested artificial intelligence's ability to create orange T-Rex art in the style of many famous artists, using OpenAI's DALL·E 2 AI.Quick recap of how DALL·E 2 works. Users can request images of anything by .

    • Snap! Azure outage, malware in JWST images, floppy disks, Voyager 1, & more

      Snap! Azure outage, malware in JWST images, floppy disks, Voyager 1, & more

      Spiceworks Originals

      Your daily dose error code 0xeb020b9c fehler tech news, in brief. While the month may be ending, we're halfway through the week. Let's jump into today's Snap! and see some of the things going on in the world. You need to hear this. Microsoft Azure outage knocks Ubuntu.

    • Monitor our Weblogs

      Monitor our Weblogs

      Security

      Hi,I would like to ask for your recommendations on how I can capture the websites our end users access during office hours.our current firewall doesnt support it as it only logs HTTP connections and we all know that almost all of the websites now are usin.

    Parse error: syntax error, unexpected (T_VARIABLE), expecting ',' or ')'

    Did you look at the way the forum highlighted your code? The variables you placed in the SQL statement are not the same color as the SQL statement itself. You’re using the double quote both as the string delimiter in PHP as well as the string delimiter in the SQL statement, so PHP is thinks it’s PHP code.

    The quick fix could be to (note the difference in colors compared to your code):

    But ideally, you should not create SQL queries this way at all. Just dumping parse error syntax error unexpected t_variable form input in your SQL query is a great way to get your database hacked, because it leaves you wide open to SQL Injection Attacks. You should either validate or sanitize the input variables, or use parameterized canon mp160 printer error 22 to separate the data from the queries.

    Also, to save you from having to write more follow-up messages:

    • The database credentials you are using are not correct. Check the MySQL Databases in the control panel instead.
    • The is not valid. It should be instead.

    1 Like

    解析錯誤:語法錯誤,第 192 行 /functions.php 中的意外 T_VARIABLE (Parse error: syntax error, unexpected T_VARIABLE in /functions.php on line 192)

    問題描述

    解析錯誤:語法錯誤,第 192 行 /functions.php 中的意外 T_VARIABLE (Parse error: syntax error, unexpected T_VARIABLE in /functions.php on line 192)

    I have, since last morning, the following error showing up on my website hosted through godaddy.com with WP 3.2.1. I now know that the site was hacked. I don't have access to the WP admin CP since it also comes with the same error:

      

    Parse error: syntax error, unexpected T_VARIABLE in /home/content/xx/xxxxx/html/websites/xxxxxxxx/wp‑includes/functions.php on line 192

    And this is the line of code in the php file:

    Any one can help?

    this is the whole block:

    ‑‑‑‑‑

    參考解法

    方法 1:

    The line before is:

    Obviously, the line is not complete, hence the parse error.

    (by user1978137、Madara's Ghost)

    參考文件

    1. Parse error: syntax error, unexpected T_VARIABLE in /functions.php on line 192 (CC BY‑SA 3.0/4.0)

    1 Comments

    Leave a Comment