This error normally means that the query failed.
You should be checking for errors as you go like this, also the string concatenation can be made simpler if you use either the {$_COOKIE['fe_typo_user']}
form of variable expansion inside a double quoted string, or alternatively this will also work $_COOKIE[fe_typo_user]
$sql = "select ses_userid
from fe_sessions
where ses_id = '{$_COOKIE['fe_typo_user']}'"
$result_id_check = mysql_query($sql);
if ( $result_id_check === false ) {
echo mysql_error();
echo 'Bad SQL : ' . $sql;
exit;
}
$row_check = mysql_fetch_object($result_id_check);
This way when you make small mistakes with your SQL, you get told about them directly and you dont have to wonder what nay have gone wrong.
Please dont use the mysql_
database extension, it
is deprecated (gone for ever in PHP7)
Specially if you are just learning PHP, spend your energies learning the PDO
database extensions.
Start here
You should also be using parameterized queries ( available in the mysqli_
and PDO
database extensions, but not the old deprecated mysql_
extension) to avoid SQL Injection Attack Specially if you are using data got from $_POST
or $_GET
or $_COOKIE
If you are considering moving to mysqli_
or PDO
you should read also read this Can I mix MySQL APIs in PHP?