PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
$date = date("Ymd");
$alreadyvotedsql = "SELECT whovoted FROM faceoffvotes WHERE faceoffid = '$faceoffid' AND date = '$date'";
$alreadyvotedquery = mysql_query($alreadyvotedsql);
$alreadyvotedarray = mysql_fetch_array($alreadyvotedquery);
if(in_array($_COOKIEї'username'], $alreadyvotedarray)){ echo "You have already voted on this faceoff matchup today. You can vote again tommorow"; require 'footer.php'; die(); }
}
The array when printed to the browser is "Array."
How can I fix this to be a list of names from the query?
if(in_array($_COOKIEї'username'], $alreadyvotedarrayї'whovoted']))
{
echo "You have already voted on this faceoff matchup today. You can vote again tommorow";
require 'footer.php';
die();
}
it will not be as such. You retrieve 1 row from the table for every record that matches when you call mysql_fetch_* .. since it looks like you are searching for a particular user, why not restrict the query to that user?