[RESOLVED] I don't get it - SQL? Whats up with this
PHP Code:
<?
//Database Information
$dbhost = "";
$dbname = "";
$dbuser = "";
$dbpass = "";
//Connect to database
mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
mysql_select_db($dbname) or die(mysql_error());
session_start();
$username = $_POST[‘username’];
$password = md5($_POST[‘password’]);
$query = (“SELECT * from users where username=’$username’ and password=’$password’”); - THIS IS THE Erroneous Line
$result = mysql_query($query);
if (mysql_num_rows($result) != 1) {
$error = “Bad Login”;
include “index.htm”;
} else {
$_SESSION[‘username’] = “$username”;
include “X.php”;
}
?>
Error: Unexpected T_STRING on Line 17 ( See above) I've marked it.
Re: I don't get it - SQL? Whats up with this
Make sure the quotemarks after $password are a follows: ONE single tick ' followed by a DOUBLE quote "
Also take off the parens from the same line.
-tg
Re: I don't get it - SQL? Whats up with this
Hi,
Im using '""; after password, (looked like i wasn't in this forum) i only put in the brackets when I had that error before. I still have the error with:
Code:
$query = “SELECT * from users where username=’$username’ and password=’$password'";
Whats wrong, i've tried using an Sql 4.0 and an SQL 5.0 db, no luck.
Re: I don't get it - SQL? Whats up with this
whatever text editor you're using (and copying from) isn't creating a double quote ("), but rather creating a different kind of quote (“). can you see the difference? one is a quote slanted in, and that just won't do.
“"“" -- might be a bit hard to see the difference.