Jump to content

SQL update problem


JJBlaha

Recommended Posts

if($read == '0') {
$sql2 = "UPDATE privatemessages SET read = '1' WHERE id='$id'";
$result2 = @mysql_query($sql2,$connection);
if($result2) {
echo "great success!";
} else {
echo "you fail!";
}
}

outputs you fail!

i know the id whatever is there, and i know the read is set to 0 there so why doesnt the script work?
Link to comment
https://forums.phpfreaks.com/topic/27298-sql-update-problem/
Share on other sites

Change it to read:
[code]
<?php

$result2 = mysql_query($sql2, $connection) or die("MySQL Error: <br />{$sql2}<br /> ". mysql_error());

?>
[/code]

the die() section will stop the rest of the script and the mysql_error() will output what is wrong if its a MySQL issue.
Link to comment
https://forums.phpfreaks.com/topic/27298-sql-update-problem/#findComment-124822
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.