prevent duplicate entries
===

Basically it look through the mp3 files in the folder and then `insert` into mysql database if `number` does not exist.

Problem is `INSERT` (mysql) has been inserted more than 1 time but with different `member_id`'s with same `number`. This shouldn't happen.

4 staffs are executing this scripts. What causing this and how to fix?


    if ($handle = opendir($audioPath)) {
        while (false !== ($entry = readdir($handle))) {
            $file = pathinfo($entry);
            if ($entry != "." && $entry != ".." && !is_dir($audioPath . "/" . $entry) && $file['extension'] == 'mp3') {
                $number = $file['filename'];
                $SQL = "SELECT mobile, status, member_id, count(*) as Total from result WHERE number = :number";
                $query = $this->db->prepare($SQL);
                $query->bindValue(":number", $number);
                $query->execute();

                $row = $query->fetch(PDO::FETCH_ASSOC);

                // Check if number is exist in the table
                if ($row['Total'] == 0) {
                    $SQL = "INSERT INTO result (number, status, status_date, member_id) VALUES ('$number', 'pending', now(), '$memberId')";
                    $queryInsert = $this->db->prepare($SQL);
                    $queryInsert->execute();
                    break;
                } 
            }
        }
    }

after `break` it play mp3 via media player plugin.