love this site, I have been learning mysql and php to help me design and iPhone Messaging client (for recreational purpose, and not publishing to app store)
I am having an issue, trying to update a specific item in a table, basically I am trying to let the message be marked as read once the user reads the message, however have been getting the error
Error Message:
Could not update data: 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 'read='MAYBE' WHERE id='19'' at line 1
Here is the URL EXAMPLE I am sending the GET from. this should find row/id # 19 and mark READ as YES, so it has been read, previously it was set to NO.
http://myawesomesite.com/markasread.php?idnumber=19&readmessage=MAYBE
Here is my code:
<?php
$useridnumber = $_GET['idnumber'];
$didread = $_GET['readmessage'];
$conn = mysql_connect("sqlurl.com","sqllogin","sqlpassword");
if(! $conn )
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db('mydatabase');
$sql = ("UPDATE messages SET read='$didread' WHERE id='$useridnumber'");
$retval = mysql_query( $sql, $conn );
if(! $retval )
{
die('Could not update data: ' . mysql_error());
}
echo "Updated data successfully\n";
mysql_close($conn);
?>
any help or clarification would be amazing, I understand having my login information on the same php and sql injections, but figured since this app is dedicated to only two people for private chatting that I would not need to really address any security concerns at this point.... :-)