I have been trying to figure this out myself, but I am having no luck. Here is the following code that I have written:
if (mysql_query("SELECT * FROM weekly_picks WHERE tournament = '$tournament' AND usr = '$usr'"))
mysql_query("UPDATE weekly_picks SET player = '$golfer' WHERE tournament = '$tournament' AND user = '$usr'");
else
mysql_query("INSERT INTO weekly_picks (t_id, tournament, user, player, backup, timestamp) VALUES ('$t_id', '$tournament', '$usr', '$golfer', '$backup', '$time')",$link) or die('Error, insert query failed');
This code will run, but all it does is add a new row into my database instead of updating what is already there when needed. Any help would be much appreciated.