Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP+MYSQL: Problem with Update query
    text
    copied!<p>I'm having problems running this query. I keep on getting the error:</p> <blockquote> <p>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 = 'readd' WHERE user_id = '1' LIMIT 1' at line 1</p> </blockquote> <p><strong>The code</strong></p> <pre><code> $conn = mysql_connect('localhost', 'admin', 'root') or die(mysql_error()); mysql_select_db('main') or die(mysql_error()); $read = "message read"; $set_statuss = "UPDATE inbox ". "SET read = '".$read."' ". "WHERE user_id = '".$_SESSION['user_id']."' ". "LIMIT 1"; </code></pre> <p>Edit: This is the table:</p> <pre><code> CREATE TABLE `inbox` ( `inbox_id` int(5) NOT NULL auto_increment, `posted_to` int(5) NOT NULL, `posted_by` int(5) NOT NULL, `subject` text NOT NULL, `message` text NOT NULL, `date_posted` datetime NOT NULL, `read` text NOT NULL, PRIMARY KEY (`inbox_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ; </code></pre> <p>Edit: Updated the query, but now the PHP is just appearing as white..</p> <pre><code> $read = "read"; $set_statuss = "UPDATE inbox ". "SET read = '".$read."' ". "WHERE posted_to = '{$_SESSION['user_id']}' AND inbox_id = '".$_GET['msg_id'];."' "; mysql_query($set_statuss) or die(mysql_error() . $set_statuss); </code></pre> <p>And the url in the address bar: </p> <pre><code> http://localhost:8888/wmin/msg.php?user_id=1&amp;msg_id=2 </code></pre> <p>Does anyone see where i'm going wrong? Thanks!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload