Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

syntax error, unexpected T_VARIABLE [closed]

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

like image 358
Cory Fournier Avatar asked Feb 03 '12 21:02

Cory Fournier


People also ask

What does T_variable mean?

A T_VARIABLE is a Token of type VARIABLE. When the parser processes tokens, it tries to make sense of them, and throws errors if it receives a variable where none is allowed.

What is unexpected variable in PHP?

Unexpected – This means the code is missing a character and PHP reaches the end of the file without finding what it's looking for.

What is the main characteristic of a syntax error?

In computer science, a syntax error is an error in the syntax of a sequence of characters or tokens that is intended to be written in a particular programming language. For compiled languages, syntax errors are detected at compile-time. A program will not compile until all syntax errors are corrected.


1 Answers

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

like image 77
LoveAndCoding Avatar answered Oct 04 '22 09:10

LoveAndCoding