$sql = mysql_query("SELECT ip FROM `lentele` WHERE `id` = 'X' ");
while ($row = mysql_fetch_assoc($sql)) {
$ip_list = explode(',', $row['ip']);
if (in_array($_SERVER['REMOTE_ADDR'], $ip_list)) {
echo 'tu jau balsavai bla bla bla.';
} else {
$ip = $_SERVER['REMOTE_ADDR'];
kodas kuris prideda taska ar kita suda.
...
mysql_query("UPDATE `lentele` SET `ip` = CONCAT(ip,',$ip') WHERE `id` = 'X'
");
}