Hello!
I am having trouble with this, if no rows are affected, I would like to do the Insert. I have been reading the manual here: http://www.php.net/manual/en/function.mysql-affected-rows.php but don't get the pieces together. I also got an error on the SQL query.
<?php
$Link = mysql_connect("localhost", "xxxx", "xxxxxx");
mysql_select_db("xxxxxx", $Link);
$Query = "UPDATE songrequests SET amount = amount + 1 where artist='$artist' and song='$song'";
mysql_db_query ("xxxxx", $Query, $Link) or die (mysql_error());
if (mysql_affected_rows()==0) {
$Query = "INSERT INTO songrequests(artist,song,amount) VALUES ($artist, $song, '1')";
mysql_db_query ("xxxxxx", $Query, $Link) or die (mysql_error());
}
echo "Song request is added";
?>
Eror msg:
You have an error in your SQL syntax near ' , 1 )' at line 1
Happy for any help.