Update or insert

Is there an easier way to do this as it is a bit truncated

$sql = mysql_query("SELECT something FROM somewhere WHERE something = somethingelse");
$rows = mysql_num_rows($sql);

if(isset($rows)) {
mysql_query("UPDATE something SET ('somethong' = 'somethingelse') WHERE this = that");
} else {
mysql_query("INSERT INTO something (this, that, theother) VALUES ('this', 'that', 'theother')");
}

I have come across this

mysql_query("REPLACE INTO

It seem so work ok but when working with multiple records its adding a blank recoerd at the beginning

Sponsor our Newsletter | Privacy Policy | Terms of Service