So usually I know to fix syntax errors. This one got me stumped. I submitted my code and this cane up...
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near """"""" at line 1
The reason this stumped me is because if you see here...
<?php
session_start();
$message="";
if(count($_POST)>0) {
$conn = mysql_connect(""");
mysql_select_db(""""",$conn);
$result = mysql_query("SELECT * FROM users WHERE 'userName='" . $_POST["userName"] . "' and password = '". $_POST["""""]."'");
if($result === FALSE) {
die(mysql_error());
}
$row = mysql_fetch_array($result);
if(is_array($row)) {
$_SESSION["user_id"] = $row[user_id];
$_SESSION["user_name"] = $row[user_name];
} else {
$message = "Invalid Username or Password!";
}
}
if(isset($_SESSION["user_id"])) {
header("Location:user_dashboard.php");
}
?>
My syntax error is on line one, yet line one is nothing but <?php
and I don't think that is a syntax error,..
I know it must be somewhere else on the code, but saying on line one is really throwing me off.
Can someone help me find the syntax error please?
Note: When you check my code """"" = private information, and is not necessary information.
Also Note: when I tried to remove the '
symbol it then said
Unknown column 'password' in 'where clause'