I have a large array. Is there an alternate method to check if $value in the array is present in the MySql table vote and if not then insert $value into vote. This is what i am doing currently. Is there a better method?
foreach($rowids as $value) {
$select = mysql_query("SELECT voteid FROM vote WHERE username='$username' AND voteid='$value' LIMIT 1",$this->connect);
if(mysql_num_rows($select)==0) {
$insert = mysql_query("INSERT INTO vote VALUES ('','$value','$username')",$this->connect);
}
}