prepare("SELECT * FROM `send_all` WHERE `status` = 0 LIMIT :limit"); $send_all->bindValue(':limit', $limit, PDO::PARAM_INT); $send_all->execute(); if ($send_all->rowCount() == 0) { die("هیچ پیامی برای ارسال وجود ندارد."); } $delete_stmt = $db->prepare("DELETE FROM `send_all` WHERE `id` = :id"); $success_count = 0; $fail_count = 0; while ($row = $send_all->fetch(PDO::FETCH_ASSOC)) { $user_id = $row['chat_id']; $text = $row['text']; $id = $row['id']; $response = $bot->sendMessage($user_id, $text); if (isset($response->ok) && $response->ok) { $success_count++; } else { $fail_count++; } $delete_stmt->execute(['id' => $id]); } die;