PHP/MySQL: UPDATE issue
Posted: Wed Jun 02, 2010 7:54 pm
I'm trying to write a script that will edit a database row but there is a problem in my code I can't seem to find. I'm sure it's obvious, but yet it eludes me.
mysql_error() won't even report anything back
Here the part that I think is causing the problem:
I can add the full script if needed.
Thanks in advance for your input.
mysql_error() won't even report anything back
Here the part that I think is causing the problem:
Code: Select all
$query = "UPDATE album_list SET album_name = '$album_name', description = '$desc', caption = '$caption' WHERE album_id = '$album_id'";
$result = mysql_query($query) OR die (mysql_error());
if(mysql_affected_rows() == 1) {
echo "<p>You have succesfully updated album <i>$album_name</i>!</p>";
mysql_close();
exit();
} else {
echo mysql_error();
echo "<p>System Error! Could not update album.<br /> " . mysql_error() . "<br /><br />Query: " . $query . "</p>";
mysql_close();
}Thanks in advance for your input.