Forum Moderators: coopster
However, there are some cases where the row doesn't exist yet, in which case I need to insert a new row.
Right now my current script updates one row, and inserts a second. Any ideas what I'm doing wrong?
mysql_query("UPDATE votes set score=score+'".$vote."', votes=votes+1 where id='".$id."'");
if(mysqli_affected_rows()==0) mysql_query("INSERT INTO votes (id, score, votes) VALUES ('".$id."', '".$vote."', 1)");
I'm going to set id to unique, but I was hoping to have my code structureally correct too.