• 23-11-2022, 16:45:07
    #1
    Merhabalar, kodlar ve çıktı altta. her hafta 1 kere hesaplanması için ne yapabilirim?


    $query = $db->query("SELECT * FROM siparisler WHERE uyemail = '$uyemail'", PDO::FETCH_ASSOC);
    if ( $query->rowCount() ){
         foreach( $query as $row ){
            
             $hafta_cek = $row['hafta'];
             if($hafta_cek != ""){
            $hafta[] =  $row['hafta'];
            $haftadondur[$hafta];
             }
         }
         }
    
        $dizi = $hafta;
    
        foreach( $dizi as $hafta ) {
            echo "Hafta : $hafta <br />";
            
            
            $query = $db->query("SELECT * FROM siparisler WHERE uyemail = '$uyemail' AND hafta ='$hafta'", PDO::FETCH_ASSOC);
            if ( $query->rowCount() ){
         foreach( $query as $row ){
              echo $row['ucret']."<br>";
         }
            }
            
            
            
            
        }
    Hafta : 3
    11
    10
    Hafta : 3
    11
    10
    Hafta : 2
    2
    3
    Hafta : 2
    2
    3
    Hafta : 1
    7
    1
    Hafta : 1
    7
    1
  • 23-11-2022, 16:46:26
    #2
    cron ata her hafta çalışsın bir kere
  • 23-11-2022, 16:47:56
    #3
    Sonuçta her hafta 1 kere listelenmesini istiyorum.
    örnek :
    Hafta : 3
    11
    10
    Hafta : 2
    2
    3
    Hafta : 1
    7
    1

    bu şekilde listelenmesini istiyorum
  • 23-11-2022, 16:51:06
    #4
    hocam neden bu kadar karmaşık kodladınız acaba insan ne yapmak istediğinizi anlamakta zorlanıyor
  • 23-11-2022, 17:39:39
    #5
    Php de array_unique fonksiyonunu deneyin bi