0
        <?php
    if (!empty($_GET['reads'])){

    $result = mysql_query("UPDATE pm SET read='1' id='".mysql_real_escape_string($_GET['reads'])."'")
or die(mysql_error());
    }
    ?>

This brings me back the following error message, when trying to use the link to call 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 'read='1' id='137970'' at line 1



I am struggling to see why this is happening, when this code works perfectly fine with no issues ;

<?php
if (!empty($_GET['delete'])){

    $result = mysql_query("UPDATE hd SET del='1' WHERE id='" .mysql_real_escape_string($_GET['delete']). "'")
    or die(mysql_error());
} ?>



They are essentially the same apart from it is 'reads' on one and 'delete' on another...

Zoltan
  • 93
  • 7
  • try to scape fields and add comma between fields `\`read\`='1', id=` – Nomad Webcode Jul 15 '15 at 18:45
  • 1
    Sorry it should have been WHERE id= etc. I have added WHERE and put `read` and this has worked. On the "Duplicate" as the topic was marked as, Read isn't on there as being a Reserved Word, so that didn't help unfortunately. But it now works. Many thanks – Zoltan Jul 15 '15 at 18:56

0 Answers0