This is what I'd use (off the top of my head):
code:
$query1 = "update referals2 set amount=(amount+1) where website='$referal'";
$query2 = "insert into referals2 values('','$referal','')";
mysql_query($query1) or die ("Failed to update the database, this is a connection / database not exist problem.");
if (mysql_affected_rows() == 0) {
mysql_query($query2) or die ("Failed to insert new record, this is a connection / database problem.");
}
You'll probably also want to query query1 after query2, if I get the way your thing works