You can do something like:
function updateValue()
{
mysql_query($sql);
return mysql_affected_rows() > 0;
}
From the comment of BoltClock:
Keep in mind that mysql_affected_rows () returns 0 if the row exists, but the old and new values are equal (which means no update is required).
source
share