<SCRIPT language="Javascript">
function vote()
{
<?php
$date = date("Y-m-d");
//$vote = mysql_num_rows(mysql_query("SELECT * FROM funny_thumbs WHERE ip='$ip' AND date='$date' AND id='$p'"));
if (mysql_num_rows(mysql_query("SELECT * FROM funny_thumbs WHERE ip='$ip' AND date='$date' AND id='$p'")) < 1)
{
mysql_query("INSERT INTO funny_thumbs SET ip='$ip', type='1', date='$date', id='$p'");
}
if (mysql_num_rows(mysql_query("SELECT * FROM funny_thumbs WHERE ip='$ip' AND date='$date' AND id='$p'")) >= 1)
{
?>
alert("Jus jau balsavote !");
<?php
}
?>
}
</SCRIPT>
<td>
<a href="#">
<img src="img/thumbs_up.png" alt="LIKE" onclick="vote(); return false;"/>
</a>
</td>
I already set $ip and $p. When i refresh page, it insert string without clicking on the link. Why ?