Joined
·
648 Posts
Hey,
I have a problem. I am trying to get a UserTo table from MySQL to ensure that the mail was meant for the reader logged in. To do this i'm using:
As you can see near the end i've printed the $row[UserTo] variable to see what it outputs. It doesn't give me anything which is why it isn't equal to $cookie.
$cookie works and prints the logged in username. $table and the database connection works too so i'm finding it difficult to assess this problem.
If anybody could point out what i'm doing wrong or what's wrong with this code I would be very grateful.
Thanks!
I have a problem. I am trying to get a UserTo table from MySQL to ensure that the mail was meant for the reader logged in. To do this i'm using:
PHP:
$result = mysql_query("SELECT * FROM $table WHERE UserTo='$cookie' AND mail_id='$mail_id'") or die ("
Can't execute $sql: " .mysql_error());
$row = mysql_fetch_array($result);
if($row[UserTo]==$cookie)
{
}
else
{
echo "
[B]This isn't your mail![/B]
" .$row[UserTo];
exit;
}
$cookie works and prints the logged in username. $table and the database connection works too so i'm finding it difficult to assess this problem.
If anybody could point out what i'm doing wrong or what's wrong with this code I would be very grateful.
Thanks!