I am trying to detect whether a record exists in a table. If so, I need to update it. If not, I new to create it. My code is below.
If the record already exists, everything works fine. I can't detect whether the record doesn't exist however.
Any help would be GREATLY appreciated.
MLC
$sql = "SELECT * from Scores_raw WHERE idAbstract='$idAbstract' AND reviewerID='$reviewerID'";
$result = mysql_query($sql);
if(!$result)
{
$sql = "insert into Scores_raw (idAbstract, reviewerID) values ('$idAbstract','$reviewerID')";
$result = mysql_query($sql);
}
$sqld = "UPDATE Scores_raw SET introduction='$introduction',methods='$methods',results='$results',conclusion='$conclusion',overall='$overall',comments='$comments',total='$total' WHERE idAbstract='$idAbstract' AND reviewerID='$reviewerID'";
$result = mysql_query($sqld);