Original Post
I have encountered an error that I think is the first of its kind in history. This UPDATE will not execute. It throws no error. The name,email,phone,and body information display but the UPDATE does not execute. I have tried every combination of single quotes. I put them around the field names, the values, neither, and both. When I try to execute this query in phpmyadmin's console directly I get this: 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 'mysql_query("UPDATE submissions SET read = '1' where id = '$id'")' at line 1 And here is the funny part: When I have phpmyadmin generate the query itself it has me reference submissions like this: db_name.submissions But this is outrageous. There is no reason why my original UPDATE query should not work.
<?php
session_start();
mysql_connect("localhost", "root", "password");
mysql_select_db("db_name");
$id = $_GET[id];
if ($_SESSION['auth'] == "yes")
{
$query = mysql_query("SELECT * from submissions WHERE id = $id");
$query = mysql_fetch_array($query);
echo "Name: $query[name]
";
echo "Email: $query[email]
";
echo "Phone: $query[phone]
";
echo "Body: $query[body]
";
mysql_query("UPDATE submissions SET read = '1' where id = '$id'");
}
else echo "you don't have permission to view this resource";
?>