Şimdi Ara

Php ile Mysql'deki verileri sayfalama

Daha Fazla
Bu Konudaki Kullanıcılar: Daha Az
2 Misafir (1 Mobil) - 1 Masaüstü1 Mobil
5 sn
4
Cevap
0
Favori
767
Tıklama
Daha Fazla
İstatistik
  • Konu İstatistikleri Yükleniyor
0 oy
Öne Çıkar
Sayfa: 1
Giriş
Mesaj
  • Veri sayfalama ile ilgili forumları gezdim ve kendi veritabanıma uydurmaya çalıştım fakat olmadı. Aşağıda kodumu verdim. Bilen ve yardımcı olabilecek arkadaşlardan yardım istiyorum.

    <? 
    // Change the databasesettings to fit Your server
    $connect = @mysql_connect("localhost", "root", "") or die ("<b style='color:red;'>Unable To Connect To Database Server.</b>");
    $db = @mysql_select_db("hitcounter") or die ("<b style='color:red;'>Unable To Connect To Selected Database.</b>");
    ?>

    <?
    function SplitDate($Date) {
    $String = substr($Date,0,4) . "-" . substr($Date,4,2) . "-" . substr($Date,6,2);
    return $String;
    }

    function SplitTime($Time) {
    $String = substr($Time,0,2) . ":" . substr($Time,2,2) . ":" . substr($Time,4,2);
    return $String;
    }
    ?>

    <title>Siteniz İstatistikleri</title>
    <style type="text/css">
    <!--
    .style1 {
    color: #FF0000;
    font-weight: bold;
    }
    -->
    </style>

    <tr style="height: 100%;">
    <td style="width:140px;">
    <table width=100% border=0>
    <tr>
    <td align=center class=small>
    </td>
    </tr>
    </table>
    </td>
    <td colspan=2>
    <table border=0 width=844>
    <tr>
    <td width="838">
    <table class=1box>
    <tr><td></td></tr>
    <tr class=header>
    <td ><span class="style1">Sitenizden istatistikler </span></td>
    </tr>
    </table> </td>
    </tr>
    <?
    $MySQL = "SELECT Date, count(Date) as Visitors, SUM(Hits) as NoOfHits, Host, URI FROM hitcounter GROUP BY Host, URI, Date;";
    $Visits = mysql_query($MySQL);
    ?>
    <?
    $MySQL = "SELECT * FROM hitcounter ORDER BY Date, IP;";
    $Visits = mysql_query($MySQL);
    ?>
    <tr>
    <td>
    <table class=1box>
    <tr><td width="454"></td>
    </tr>
    <tr class=header>
    <td ><strong>Ayrıntılar</strong></td>
    </tr>
    <tr>
    <td><br>
    <table border="1" cellspacing="3" cellpadding="3" bordercolor="#AAAAAA" style="border-collapse: collapse; border: 1px solid #AAAAAA;">
    <tr class=header>
    <th align=center>IP address</th>
    <th align=center>Date</th>
    <th align=center>Last visit</th>
    <th align=center>Host</th>
    <th align=center>URL</th>
    <th align=center>Country<br>code</th>
    <th align=center>No of<br>Hits</th>
    </tr>
    <? while ( $Visit = mysql_fetch_array($Visits) ) {
    echo("<tr class=small>");
    echo("<td>" . $Visit['IP'] . "</td>");
    echo("<td>" . SplitDate($Visit['Date']) . "</td>");
    echo("<td>" . SplitTime($Visit['Time']) . "</td>");
    echo("<td>" . $Visit['Host'] . "</td>");
    echo("<td>" . $Visit['URI'] . "</td>");
    echo("<td align=center>" . $Visit['Country'] . "</td>");
    echo("<td align=center>" . $Visit['Hits'] . "</td>");
    echo("</tr>");
    }?>
    </table><br><br> </td>
    </tr>
    </table> </td>
    </tr>
    <tr><td> </td></tr>
    </table>
    <br>
    </td>
    </tr>
    </BODY>
    </html>







  • sutun adlarını kontrol et hata aldığın yerleri belirt
  • Sağol, fakat hallettim.
  • Aşağıdaki şekilde Kodları değiştirdim ve oldu.

    <? 
    // Change the databasesettings to fit Your server
    $connect = @mysql_connect("localhost", "root", "") or die ("<b style='color:red;'>Unable To Connect To Database Server.</b>");
    $db = @mysql_select_db("hitcounter") or die ("<b style='color:red;'>Unable To Connect To Selected Database.</b>");
    ?>
    <?
    function SplitDate($Date) {
    $String = substr($Date,0,4) . "-" . substr($Date,4,2) . "-" . substr($Date,6,2);
    return $String;
    }
    function SplitTime($Time) {
    $String = substr($Time,0,2) . ":" . substr($Time,2,2) . ":" . substr($Time,4,2);
    return $String;
    }
    ?>
    <title>Siteniz İstatistikleri</title>
    <style type="text/css">
    <!--
    .style1 {
    color: #FF0000;
    font-weight: bold;
    }
    body {
    margin-left: 0px;
    margin-top: 0px;
    }
    -->
    </style>

    <tr style="height: 100%;">
    <td style="width:140px;">
    <table width=100% border=0>
    <tr>
    <td align=center class=small>
    </td>
    </tr>
    </table>
    </td>
    <td colspan=2>
    <table border=0 width=844>
    <tr>
    <td width="838" colspan=2>
    <table class=1box>
    <tr><td></td></tr>
    <tr class=header>
    <td ><span class="style1">Sitenizden istatistikler </span></td>
    </tr>
    </table> </td>
    </tr>
    <?
    $MySQL = "SELECT Date, count(Date) as Visitors, SUM(Hits) as NoOfHits, Host, URI FROM hitcounter GROUP BY Host, URI, Date";
    $Visits = mysql_query($MySQL);
    ?>
    <?
    $deger = $_GET['d'];
    $deger1 = $deger * 9 ;
    $deger2 = ($deger * 9) - 9 ;
    $limitler = 9; // 1 sayfadaki mesaj sayısı

    $MySQL = "SELECT * FROM hitcounter where ID between $deger2 and $deger1 ORDER BY Date, IP limit $limitler;";
    $Visits = mysql_query($MySQL);
    ?>

    <tr>
    <td colspan=2>
    <table class=1box>
    <tr><td width="454"></td>
    </tr>
    <tr class=header>
    <td ><strong>Ayrıntılar</strong></td>
    </tr>
    <tr>
    <td><table border="1" cellspacing="3" cellpadding="3" bordercolor="#AAAAAA" style="border-collapse: collapse; border: 1px solid #AAAAAA;">
    <tr class=header>
    <th align=center>IP address</th>
    <th align=center>Date</th>
    <th align=center>Last visit</th>
    <th align=center>Host</th>
    <th align=center>URL</th>
    <th align=center>Country<br>code</th>
    <th align=center>No of<br>Hits</th>
    </tr>
    <? while ( $Visit = mysql_fetch_array($Visits) ) {
    echo("<tr class=small>");
    echo("<td>" . $Visit['IP'] . "</td>");
    echo("<td>" . SplitDate($Visit['Date']) . "</td>");
    echo("<td>" . SplitTime($Visit['Time']) . "</td>");
    echo("<td>" . $Visit['Host'] . "</td>");
    echo("<td>" . $Visit['URI'] . "</td>");
    echo("<td align=center>" . $Visit['Country'] . "</td>");
    echo("<td align=center>" . $Visit['Hits'] . "</td>");
    echo("</tr>");
    }
    $result2 = mysql_query(" select * from hitcounter ");
    $kayit = mysql_numrows($result2)/ $limitler;
    $i = 0;
    while ( $kayit > $i )
    {
    $i= $i+1;
    ?>
    <a data-test="test" rel="nofollow" style="word-wrap: break-word; text-decoration: underline;" target="_blank" onclick="return dhExternalLinkRedirect(this)" href="/ExternalLinkRedirect?module=pgdcode&messageId=11814602&url=stats.php?d=<?=$i?>" data-href="stats.php?d=<?=$i?>"><?=$i?></a>
    <?
    }
    ?>
    </table><br><br> </td>
    </tr>
    </table> </td>
    </tr>

    </table>
    </td>
    </tr>




  • Yapay Zeka’dan İlgili Konular
    php database veri eklemede hata
    geçen yıl açıldı
    Daha Fazla Göster
    
Sayfa: 1
- x
Bildirim
mesajınız kopyalandı (ctrl+v) yapıştırmak istediğiniz yere yapıştırabilirsiniz.