while (my @row2 = $sth->fetchrow_array) { sleep 1; $Letter++; if (@row[1] == 1) { $Correct = $Letter; } $sql = "INSERT INTO open_questions SET Nick = '$Nick',QuestionID = '$qid', CorrectAnswer = '$Correct'"; $sth = $dbh->prepare($sql); $rv = $sth->execute; print $sock "PRIVMSG $Chan :$Nick: $Letter.) @row2[0]\r\n"; }