PHP Error T_STRING
Parse error: syntax error, unexpected T_STRING in /opt/lampp/htdocs/Community/register.php on line 84
I get that error, here is line 84 of my code.
if ($firstname && $lastname && $username && $email && $password && $repassword){
if ($password == $repassword){
if (strstr($email, "@") && strstr($email, ".") && (strlen($email) >= 6)) {
require("scripts/connect.php");
$query = mysql_query("SELECT * FROM users WHERE username='$username');
$numrows = mysql_num_rows($qu开发者_运维知识库ery);
if ($numrows == 0){ $query = mysql_query("SELECT * FROM users WHERE email='$email'");
}
}
}
}
Any ideas as to how I can fix this?
I see by the code pasted in your (hard to read) comment that the problem is on a line several lines before the line posted in your question which is missing a close quote. The line that reads:
$query = mysql_query("SELECT * FROM users WHERE username='$username');
should be:
$query = mysql_query("SELECT * FROM users WHERE username='$username'");
And BTW, you may want to do some research on SQL injection as I believe your code may have some vulnerabilities.
There is a missing "
here:
$query = mysql_query("SELECT * FROM users WHERE username='$username'");
^
I got it. Never closed the string of the first query:
"SELECT * FROM users WHERE username='$username');
Notice missing close quotation.
I suggest using a syntax highlighting text editor.
精彩评论