if ($bbuserinfo[userid]!=0) { if ($voted = $DB_site->query_first("SELECT * FROM prijsvraag WHERE userid='$bbuserinfo[userid]'")) { // Display already voted code } else { // Display not voted code } }