Jump to content

Help With UPDATE


monkeypaw201

Recommended Posts

Here is the code:

 

<?php

$con = mysql_connect("localhost","user","pass");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }mysql_select_db("database", $con);

mysql_query("UPDATE private_messages SET read = 'Yes'
WHERE id = '$_GET[id]'");mysql_close($con);
?>

 

Its not working... no errors, the page loads fine, it just doesnt update

Link to comment
https://forums.phpfreaks.com/topic/91972-help-with-update/
Share on other sites

Put the query in a string, echo the query to make sure it is reading your id, and use mysql_error() after your query to see if there are any errors.

 

Query in string outputs: UPDATE private_messages SET read = 'Yes'

WHERE id = '1'

 

mysql_error after query outputs:

 

(nothing)

 

Soooo Lost...

Link to comment
https://forums.phpfreaks.com/topic/91972-help-with-update/#findComment-471071
Share on other sites

Try:

<?php

$con = mysql_connect("localhost","user","pass");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }mysql_select_db("database", $con);

mysql_query("UPDATE `private_messages` SET `read`='Yes' WHERE `id`='" . $_GET['id'] . "')or die(mysql_error()); mysql_close($con);
?>

Link to comment
https://forums.phpfreaks.com/topic/91972-help-with-update/#findComment-471191
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.