~(.*)<\/a><\/li>/', $data, $matches); foreach ($matches[1] as $user) { $stmt = $db->prepare("INSERT INTO `websites` (login_name) VALUES(:login_name)"); $stmt->bindParam(':login_name', $user); $stmt->execute(); } ?>