• 11-10-2008, 20:58:31
    #1
    Aşağıdaki kod'da limit 5 olmasına rağmen genede gösterimde sadece bir tane gösteriyor ?? Hata nerde acaba anlayamadım ??

    <?php
    
    $gel=$_GET['gel'];
    $sql="SELECT * FROM Wallpapers where Category='$gel' ORDER BY RAND() LIMIT 5";
    
    $sonuc=mysql_fetch_array(mysql_query($sql));
    $title=$sonuc["Title"];
    $wallpaper=$sonuc["Wallpaper1"];
    $id=$sonuc["ID"];
    $seotitle = str_replace(" ", "+", $title);
    
    echo "
    <a href=\"/$seotitle/\"> $title </a><br>";
    
    ?>
  • 11-10-2008, 21:47:18
    #2
    Üyeliği durduruldu
    While kullanmamışsın ki birden fazla göstersin.
  • 11-10-2008, 21:54:07
    #3
    Üyeliği durduruldu
    while ($sonuc = mysql_fetch_array(mysql_query($sql))) { 
    echo '<a href=\"/'.$sonuc["title"].'/\"> '.$sonuc["title"].' </a><br>'  ; 
    }
    Denemedim kafam bir milyon hata olabilir.
  • 11-10-2008, 22:28:47
    #4
    Aşağıdaki kodu da denedim ama aynı senin verdiğin koddaki gibi durmadan ard arda bütün listeyi sıralıyor.. Liste bitmiyor haliyle, olmadı yani

    while( $sonuc=mysql_fetch_array(mysql_query($sql)) ):
    $title=$sonuc["Title"];
    $wallpaper=$sonuc["Wallpaper1"];
    $id=$sonuc["ID"];
    $seotitle = str_replace(" ", "+", $title);
    
    echo "
    <a href=\"/$seotitle/\"> $title </a><br>";
    endwhile;
  • 11-10-2008, 22:57:45
    #5
    Şunu dener misin ?

    <?php
    
    $gel=$_GET['gel'];
    $sql="SELECT * FROM Wallpapers where Category='$gel' ORDER BY RAND() LIMIT 5";
    
    $sonuc=mysql_query($sql); var_dump(mysql_num_rows($sonuc));
    $title=$sonuc["Title"];
    $wallpaper=$sonuc["Wallpaper1"];
    $id=$sonuc["ID"];
    $seotitle = str_replace(" ", "+", $title);
    
    echo "
    <a href=\"/$seotitle/\"> $title </a><br>";
    
    ?>
  • 12-10-2008, 00:10:00
    #6
    <?php
    
    $gel=$_GET['gel'];
    $sql=mysql_query("SELECT * FROM Wallpapers where Category='".$gel."' ORDER BY RAND() LIMIT 0,5");
    
    while ($sonuc=mysql_fetch_array($sql)) {
    $title=$sonuc["Title"];
    $wallpaper=$sonuc["Wallpaper1"];
    $id=$sonuc["ID"];
    $seotitle = str_replace(" ", "+", $title);
    echo "<a href=\"/$seotitle/\"> $title </a><br>";
    }
    ?>
    Birde bunu dene bakalım.
  • 12-10-2008, 01:28:08
    #7
    çok teşekkür ederim işe yaradı
  • 12-10-2008, 16:40:06
    #8
    valla hocam seninkisini görmemiştim direk en alta kaydırdığımdan olsa gerek şimdi denedim isteğin üzerine ama ne yazıkki seninkisinde hata veriyor daha doğrusu sıralayacağı yerde int(5) yazıyor..