I would like to know what code I would need to use to get the values from a row (which would naturally have data from different columns)
I would like to check if the IP address is the same as the Poll ID. As you would expect the IP address is stored in one column, and the poll id in a next column.
$q = mysql_query("SELECT * FROM logs");
while($row = mysql_fetch_array($q))
{
if(($ip = $_SERVER['REMOTE_ADDR']) == $row['ip'])
{
$duplicateIP = true;
}//end if
if(($row['poll_id'] == 1))
{
$duplicatePoll = true;
}//end if
}//end while
I realised this code won't work as it will return the poll id to be true as long as it is equal to 1. How do I ensure that it will only return to be true if that poll id matches the IP address? Thanks.
$ipelsewhere there is no need to do that variable assignment in your if statement.