• 21-05-2010, 21:24:17
    #1
    Üyeliği durduruldu
    s.a merhaba arkadaşlar

    php ile kendimi geliştirmek amacıyla basitbir blog yazıyorum blogta mysql veritabanına eklediğim veriyi sayfaya çekiyorum çekme işlemi başarılı makalelerim sayfada listeleniyor substr() fonksiyonunu kullanrakta 320 karekter olarak sayfaya yazdırdım sorum şu devamını oku linki ekledim eklediğimlinke tıklandığında makalenin tümünü ekrana yazacak


    kodlar bunlar sorun nedir acaba

    @$get_id=$_GET['id'];

    if(!isset($get_id))
    {




    $sql="select * from articles order by id desc limit 0,7";
    $query=mysql_query($sql);
    while ($getir=mysql_fetch_assoc($query)){

    $articles=substr($getir['articles'],0,420);
    $id=$getir['id'];
    $title=$getir['title'];
    $tarih=$getir['date'];
    $hit=$getir['hit'];

    echo "<font ><h2 ><a href='index.php?id=$id'>$title</a></h2></font>";
    echo " <p> $articles </p>";

    echo "<div align='right'>okunma: ". $hit ." Tarih: ".$tarih ." Devamı <a href='index.php?id=".$id."'> [...] </a></div>";



    }

    }if(!isset($get_id))
    {
    $sql="select * from articles where id='$get_id' ";
    $hit_sql=mysql_query("update articles set hit=hit+1 where id='$get_id'");
    while ($getir=mysql_fetch_assoc($query)){

    $articles=$getir['articles'];
    $id=$getir['id'];
    $title=$getir['title'];
    $tarih=$getir['date'];
    $hit=$getir['hit'];

    echo "<font ><h2 ><a href='index.php?id=$id'>$title</a></h2></font>";
    echo " <p> $articles </p>";

    echo "<div align='right'>okunma: ". $hit ." Tarih: ".$tarih ." Devamı <a href='index.php?id=".$get_id."'> [...] </a></div>";



    }
    }
    ?>



  • 21-05-2010, 21:36:58
    #2
    Üyeliği durduruldu
    kodlarını php butonuna basarak yazsaydın daha düzgün olurdu. Kafam karıştı ne nerde fln...
  • 21-05-2010, 21:49:35
    #3
    Üyeliği durduruldu
    hocam karıştır karıştır bir hal oldum valla yardıme edecek arkadaş varmı acaba.?
  • 21-05-2010, 22:06:48
    #4
    Üyeliği durduruldu
    kodlar karışık gözüküyor düzele kısmına gir php kodlarıın tamamını seç ve üstte bulunan butonlardan php olanı seçersen daha anlaşılır bir hal alır...
  • 21-05-2010, 22:21:56
    #5
    sorunu tam anlayamadım ama; isset yerine empty kullan cünkü

    @$get_id=$_GET['id']; dediğin zaman get ile gelen id boş olsa bile $get_id set edilmiş ve boş olmuş olur.
  • 21-05-2010, 22:26:24
    #6
    Eposta Aktivasyonu Gerekmekte
    @$get_id=$_GET['id'];   
     
    if(!isset($get_id))
    {
     
     
     
     
             $sql="select * from articles order by id desc limit 0,7";
             $query=mysql_query($sql);
             while ($getir=mysql_fetch_assoc($query)){
     
               $articles=substr($getir['articles'],0,420);
             $id=$getir['id'];
             $title=$getir['title'];
             $tarih=$getir['date'];
             $hit=$getir['hit'];
     
              echo "<font ><h2 ><a  href='index.php?id=$id'>$title</a></h2></font>";
              echo "  <p> $articles </p>";
     
              echo "<div align='right'>okunma: ". $hit ."    Tarih:  ".$tarih   ."  Devamı <a href='index.php?id=".$id."'> [...]  </a></div>";
     
     
     
    }
     
    }
    else
    {
        $sql="select * from articles where id='$get_id' ";
        $query = mysql_query($sql);
             $hit_sql=mysql_query("update  articles  set hit=hit+1 where  id='$get_id'");
              while ($getir=mysql_fetch_assoc($query)){
     
               $articles=$getir['articles'];
             $id=$getir['id'];
             $title=$getir['title'];
             $tarih=$getir['date'];
             $hit=$getir['hit'];
     
              echo "<font ><h2 ><a  href='index.php?id=$id'>$title</a></h2></font>";
              echo "  <p> $articles </p>";
     
              echo "<div align='right'>okunma: ". $hit ."    Tarih:  ".$tarih   ."  Devamı <a href='index.php?id=".$get_id."'> [...]  </a></div>";
     
     
     
    }
        }                               
      ?>
  • 21-05-2010, 22:31:16
    #7
    Üyeliği durduruldu
    hocam ekrana yazdırmada sorun yok sorun devamını oku linkine tıkladığı zamn ilgili yazının tamamı gelmedi lazım isset kullandım orda id değeri doğruysa ilgili makaleyi ekrana yazcak bi iki kere kurcaladım bu sefer linke tıklandığı zamn bütün makaleleri ekrana basıyor
  • 21-05-2010, 22:35:28
    #8
    Üyeliği durduruldu
    NiZZo_ adlı üyeden alıntı: mesajı görüntüle
    @$get_id=$_GET['id'];   
     
    if(!isset($get_id))
    {
     
     
     
     
             $sql="select * from articles order by id desc limit 0,7";
             $query=mysql_query($sql);
             while ($getir=mysql_fetch_assoc($query)){
     
               $articles=substr($getir['articles'],0,420);
             $id=$getir['id'];
             $title=$getir['title'];
             $tarih=$getir['date'];
             $hit=$getir['hit'];
     
              echo "<font ><h2 ><a  href='index.php?id=$id'>$title</a></h2></font>";
              echo "  <p> $articles </p>";
     
              echo "<div align='right'>okunma: ". $hit ."    Tarih:  ".$tarih   ."  Devamı <a href='index.php?id=".$id."'> [...]  </a></div>";
     
     
     
    }
     
    }
    else
    {
        $sql="select * from articles where id='$get_id' ";
        $query = mysql_query($sql);
             $hit_sql=mysql_query("update  articles  set hit=hit+1 where  id='$get_id'");
              while ($getir=mysql_fetch_assoc($query)){
     
               $articles=$getir['articles'];
             $id=$getir['id'];
             $title=$getir['title'];
             $tarih=$getir['date'];
             $hit=$getir['hit'];
     
              echo "<font ><h2 ><a  href='index.php?id=$id'>$title</a></h2></font>";
              echo "  <p> $articles </p>";
     
              echo "<div align='right'>okunma: ". $hit ."    Tarih:  ".$tarih   ."  Devamı <a href='index.php?id=".$get_id."'> [...]  </a></div>";
     
     
     
    }
        }                               
      ?>
    vayyy hocam süpersinn kaç gündür çözemedim helal olsun çok çok teşekkürler
  • 21-05-2010, 22:41:50
    #9
    Eposta Aktivasyonu Gerekmekte
    Rica ederim. Ama html ile php'yi ayırman daha faydalı olur.