• 09-04-2014, 16:25:40
    #1
    Arkadaşlar aşağıdaki kodlarla belirlenen kriterlere uygun olan yazıları listeletiyorum. Kodlardaki $ay1= kriterini eklediğim zaman hata alıyorum. $ay1= fonksiyonu da konunun bu ay veya önceki ay içinde yayınlanma kriteri. $ay1= kriterini eklemeden önce sorun yok ekleyince aşağıdaki hataları veriyor.

    Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in ...
    Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in...

    Yardımlarınızı bekliyorum.

    Teşekkürler.



    <?php
    $a5=mysql_fetch_object(mysql_query("select deger as a from poem_ayar where id='14'"));
    $a1=mysql_fetch_object(mysql_query("select deger as a from poem_ayar where id='17'"));
    $a2=mysql_fetch_object(mysql_query("select deger as a from poem_ayar where id='18'"));
    
    
    $ay1=" (( month(post_date)=month(curdate()) and year(post_date)=year(curdate())) or (month(post_date)=month(DATE_SUB( curdate( ) , INTERVAL 1 month )) and year(post_date)=year(DATE_SUB( curdate( ) , INTERVAL 1 month ))))";
    	
    $filtre=" where vote>=$a5->a and $ay1 and month(voted)=month(curdate())  and year(voted)=year(curdate())   group by id having count(*)>=$a1->a and sum(vote) >=$a2->a";
    
     
    $sor="select count(*)  as oy,sum(vote) ,id,format((sum(vote)/count(*)),1) as ortalama from poem_gdsr_votes_log   $filtre    order by (sum(vote)/count(*)) desc,count(*) desc limit 0,15
    ";
    $toplam=ceil(mysql_num_rows(mysql_query($sor))/1);
    
    
    
    
    $s_=mysql_query($sor);
    $i=1;
    while($s=mysql_fetch_object($s_)){
    	$ortalama=$s->ortalama*20;
     if(get_the_title($s->id)=="")continue;
      
     $posts = wp_get_single_post( $s->id,"ARRAY_A") ;
    
    	echo " 
    
    <li><b><a href='".get_permalink($s->id)."' class='name'>".get_the_title($s->id)."</a></b></li>
    
    ";
    }
    
    ?>
  • 09-04-2014, 18:23:58
    #2
    vote>=$a5->a and $ay1 olan yerde $ay1 değişkenine şart koymamışsınız. Tahminimce sıkıntı budur. Tam olarak inceleyemedim.

    @asilonline
  • 10-04-2014, 10:50:51
    #3
    $ay1 değişkeni listelenecek yazının önceki ay veya mevcut ay içinde yayınlanmış olma şartını koyuyor zaten. sorun başka birşey

    Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in ...
    bu hata şu kodları işaret ediyor
    $toplam=ceil(mysql_num_rows(mysql_query($sor))/1);

    Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in...
    bu hatada şu kodlara işaret ediyor.

    while($s=mysql_fetch_object($s_)){
  • 13-04-2014, 21:39:53
    #4
    ustalar bi bakıverin be.
  • 14-04-2014, 00:51:49
    #5
    1. Böyle Deneyin

    $filtre=" where vote>='$a5->a' and $ay1 and month(voted)=month(curdate()) and year(voted)=year(curdate()) group by id having count(*)>=' $a1->a' and sum(vote) >=' $a2->a' ";

    2. Böyle Deneyin

    $filtre=" where vote>={$a5->a} and $ay1 and month(voted)=month(curdate()) and year(voted)=year(curdate()) group by id having count(*)>={ $a1->a} and sum(vote) >={ $a2->a} ";

    Zannımca ikisinden birisi sorununuzu çözer
  • 15-04-2014, 15:53:41
    #6
    bi değişiklik olmadı hocam. aynı hatayı veriyor.