Firstly can I just say hello to everyone as this is my first post here.
Right, now to the problem. Basically I have a internal mail system set up and i need to have a the messages status go from 0 to 1 if it has been read. So in the inbox is a 'Read Message' button that has the following attached to it:
<a href="http://www.sitename.com/read_message.php?id=<?php echo $row_rs_messages['id']; ?>">
read.message.php contains the following:
<?php
include("config_messages.php");
$link = mysql_connect($server, $db_user, $db_pass)
or die ("Could not connect to mysql because ".mysql_error());
mysql_select_db($database)
or die ("Could not select database because ".mysql_error());
$id = $HTTP_GET_VARS['id'];
$username = $HTTP_COOKIE_VARS['mysite_username'];
$result=mysql_query("select * from $table1 where id='$id'") or die ("cant do it");
$row=mysql_fetch_array($result);
if($row[to]==$username) {
} else {
echo "<font face=verdana><b>You do not have permission to view this message.
exit;
}
$query=mysql_query("UPDATE messages SET read='1' WHERE id='$id'");
$query or die("ERROR");
header("location:http://www.sitename.com/view_message.php?id=$id");
?>
Whenever I run this it just displays the error message 'ERROR'. Can anyone help as to why this is not working. It's been doing my head all day.
Thanks in anticipation 🙂