syntax error, unexpected T_VARIABLE [closed]

99封情书 提交于 2020-01-13 08:09:14

问题


I can't seem to find where my code has went wrong. Here is my full error:

Parse error: syntax error, unexpected T_VARIABLE in C:\xampp\htdocs\GigaLoad.com\register.php on line 102

But I've been looking a that line for hours. I will give you the entire code cause my newbie brain cant find the error:

$query = mysql_query("SELECT * FROM users WHERE username='$username'")

Hope you can help if you need more info just let me know.

Here Is The Extra Code

 if (strstr($email, "@") && strstr($email, ".") && (strlen($email) >=6)){
   require ("scripts/connect.php")
   $query = mysql_query("SELECT * FROM users WHERE username='$username'") // <-- Error here
   $numrows = mysql_num_rows ($query)
   if ($numrows == 0){
        /* ... */

EDIT:

I am still getting major erros i will give the code and can you tell what i am missing


回答1:


There is no semicolon at the end of that instruction causing the error.

EDIT

Like RiverC pointed out, there is no semicolon at the end of the previous line!

require ("scripts/connect.php") 

EDIT

It seems you have no-semicolons whatsoever.

http://php.net/manual/en/language.basic-syntax.instruction-separation.php

As in C or Perl, PHP requires instructions to be terminated with a semicolon at the end of each statement.




回答2:


If that is the entire line, it very well might be because you are missing a ; at the end of the line.



来源:https://stackoverflow.com/questions/9135784/syntax-error-unexpected-t-variable

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!