A
Anonymous
Guest
i am unable to do a mysql_num_rows()
the full code works on my other website which is hosted on another server.
the mysqldatabase is empty as it should be, the following should get all info from the database into $res from the votes made, and then count the number of rows that the IP = the current $ip being used to view the page at that time.
it would then add 1 to the number of time that IP was used to vote.
The other servers mysql version is MySQL 5.0.27-community-nt
the version that this code is needed in is version MySQL 4.1.21-standard
is this why the code is not working?
thanks in advance for your help.
$res = mysql_query("SELECT * FROM votes WHERE ip = '$ip'") or die("error");
if (mysql_num_rows($res) > 0) {
$votedate = mysql_result($res, 0, "datetime");
$attempts = mysql_result($res, 0, "attempts")+1;
$res = mysql_query("UPDATE votes SET attempts='$attempts' WHERE ip = '$ip' LIMIT 1");
include("alreadyvoted.php");
mysql_close;
exit;
}
the full code works on my other website which is hosted on another server.
the mysqldatabase is empty as it should be, the following should get all info from the database into $res from the votes made, and then count the number of rows that the IP = the current $ip being used to view the page at that time.
it would then add 1 to the number of time that IP was used to vote.
The other servers mysql version is MySQL 5.0.27-community-nt
the version that this code is needed in is version MySQL 4.1.21-standard
is this why the code is not working?
thanks in advance for your help.
$res = mysql_query("SELECT * FROM votes WHERE ip = '$ip'") or die("error");
if (mysql_num_rows($res) > 0) {
$votedate = mysql_result($res, 0, "datetime");
$attempts = mysql_result($res, 0, "attempts")+1;
$res = mysql_query("UPDATE votes SET attempts='$attempts' WHERE ip = '$ip' LIMIT 1");
include("alreadyvoted.php");
mysql_close;
exit;
}