I am trying to do something with INI and mysql for UCP. Now when I want to check if row exists then UPDATE the row or if it not exist just create new row. But something is going wrong here.. I do a research but I cant find how to fix this thing.
$query = mysql_query("SELECT * FROM `podatoci` WHERE `Ime` = 'Ile_Popivanov'");
if($query) {
if(mysql_num_rows($query) == 1)
$sql = "UPDATE `podatoci` SET `Pari` = 123 WHERE `Ime` = 'Ile_Popivanov'";
else
$sql = "INSERT INTO `podatoci`(`Pari`, `Ime`) VALUES (123456, 'Ile_Popivanov')";
}
else
echo 'Nekoja greska';