Hello everyone. I am pretty much of a novice with MySQL, and I am trying to find out if there is a single query that will update an existing record, or if the record does not exist, create the record. I know I could do somthing like
Code:
$query = "UPDATE table SET name = 'new' WHERE id = '123'";
$result = @mysql_query($query);
if (!$result) {
$query = "INSERT INTO table (name, id) VALUES ('new', '123')";
$result = @mysql_query($query);
}
But is there a way to accomplish the same thing with a single database query?