You have your arguments back to front:
If you look at what I put....
$voted = mysql_num_rows($result);
if ($voted != 0 ) {
// Test failed
} else {
// Test Passed
};
Note that we test for the value of $voted being NOT EQUAL to 0 ie there is an entry therefore the user HAS voted therefore the test FAILED
If the value of $voted IS 0 then the test passes, ie the user has NOT voted.
$voted = mysql_num_rows($result);
if ($voted != 0)
{
echo "You have already voted today";
}
else
{
echo "Thanks for voting";
}