<?php
        require '../../data.php';

        $spas = "SELECT * FROM pasaran_web";
        $qpas = mysqli_query($data, $spas);

        while($fpaito = mysqli_fetch_assoc($qpas)) {
            $pp = $fpaito['nama_pasaranweb'];
            $cc = "SELECT * FROM result_lotto WHERE res_pasaran = '$pp' AND DATE(res_jam) = '$todaydate'";
            $qcc = mysqli_query($data, $cc);

            if(mysqli_num_rows($qcc) == 0) {
                $ipaito = "INSERT INTO result_lotto(res_pasaran, res_angka, res_jam) VALUES('$pp', 'xxxx', '$today')";
                $sspai = mysqli_query($data, $ipaito);
            }
        }
?>