Page 1 of 1

PHP/QUERY Error

Posted: Sat Aug 21, 2010 9:49 pm
by borobug
I keep getting an error message but I can't seem to find what I'm messing up here. :?
Parse error: syntax error, unexpected T_VARIABLE in /home/mypower5/public_html/login2.php on line 12
My code:
<?php

$username = $_POST["username"];
$password = $_POST["password"];

if ($username&&$password);
{

$connect = mysql_connect("localhost","XXXXX","XXXXXX") or die("Couldn't connect!");
mysql_select_db("mypower5_members") or die("Couldn't find db");

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

$numrows = mysql_num_rows($query);

echo $numrows;

}
else
die("Please enter username and password!");
?>

I would appreciate any help.

Thanks

Re: PHP/QUERY Error

Posted: Sat Aug 21, 2010 10:23 pm
by requinix
Double-quoted strings

If you want a literal " you have to escape it.