SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Feb 2007
    Location
    Denizli, Turkey
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem With Yesterday.PHP

    i have this code but there was a mistake. from the beginning of a month to 10th of a month the code doesn't work after 10th the code is starting to work i don'T know why or how? could you tell me how to fix this problem?
    PHP Code:
    <?
    $bugun = date("d");
    $dun = $bugun - 1;
    $ay = date("m");
    $yil = date("Y");
    if (!$_GET['sayfa']) {
    $max=0;
    } else {
    $max=($_GET['sayfa']-1)*40;
    }
    $sorgu = "SELECT * FROM konular where gun='$dun' and ay='$ay' and yil = '$yil' order by id desc limit $max,40";
    $sorgulama = mysql_query($sorgu);
    $sorguk=mysql_query("select * from konular where gun='$dun' and ay='$ay'");
    $sorgu2=mysql_num_rows($sorguk);
    if ($sorgu2>0){
    //kayıtları listele
    $no=$sorgu2;
    $tsayfa=$no/40;
    $tyeni=ceil($tsayfa);
    if ($tsayfa >1) {
    echo "<center><div class=pagi><font face=Verdana size=1>
    dunun ba\$liklari.. ($sorgu2 ba\$lik)<br>
    sayfa
    ";

    if ($sayfa >= 1 or !$sayfa) {

    $linksayfa = $sayfa - 1;
    if ($sayfa > 1 or $sayfa) {
    if ($sayfa != 1) {
    if (!$yesterday)
    echo "<a class=but href=?process=yesterday&sayfa=$linksayfa><font face=verdana size=1><<</font></a> ";
    else
    echo "<a class=but href=?process=yesterday&yesterday=vlk&sayfa=$linksayfa><font face=verdana size=2><<</font></a> ";
    }
    }

    }
    echo "
    <SELECT class=pagis onchange=\"jm('self',this,0);\" name=sayfa>";
    for ($i=1;$i<=$tyeni;$i++) {

    if ($sayfa == $i) {
    if ($yesterday)
    echo " <OPTION value=sozluk.php?process=yesterday&yesterday=vlk&sayfa=$i selected>$i</OPTION>";
    else
    echo " <OPTION value=sozluk.php?process=yesterday&sayfa=$i selected>$i</OPTION>";
    } // if
    else {
    if ($yesterday)
    echo "<OPTION value=sozluk.php?process=yesterday&yesterday=vlk&sayfa=$i>$i</OPTION>";
    else
    echo "<OPTION value=sozluk.php?process=yesterday&sayfa=$i>$i</OPTION>";
    } // new

    }
    echo "</SELECT> / $tyeni ";

    if ($sayfa >= 1 or !$sayfa) {
    if (!$sayfa)
    $sayfa = 1;

    $linksayfa = $sayfa + 1;

    if ($linksayfa <= $tyeni) {
    if (!$yesterday)
    echo " <a class=but href=?process=yesterday&sayfa=$linksayfa><font face=verdana size=1>>></font></a>";
    else
    echo " <a class=but href=?process=yesterday&yesterday=vlk&sayfa=$linksayfa><font face=verdana size=1>>></font></a>";
    }

    }


    }
    echo "
    <br>
    </center> </center>
    <TABLE cellSpacing=0 cellPadding=0 border=0>
      <TBODY>
    ";
    while ($kayit=mysql_fetch_array($sorgulama)){
    ###################### var ##############################################
    $id=$kayit["id"];
    $baslik=$kayit["baslik"];
    $tarih=$kayit["tarih"];
    $yazan=$kayit["yazan"];

    $link = ereg_replace(" ","+",$baslik);
    echo "
      <tr>
        <td><font color=#0062AD> </font><a href=\"sozluk.php?process=word&q=$link\" target=main>$baslik</a></td>
      </tr>
    ";
    }
    }
    echo "</TBODY></TABLE>";
    if ($tsayfa >1) {
    echo "<center><div class=pagi><font face=Verdana size=1>
    dunun ba\$liklari.. ($sorgu2 ba\$lik)<br>
    sayfa
    ";

    if ($sayfa >= 1 or !$sayfa) {

    $linksayfa = $sayfa - 1;
    if ($sayfa > 1 or $sayfa) {
    if ($sayfa != 1) {
    if (!$yesterday)
    echo "<a class=but href=?process=yesterday&sayfa=$linksayfa><font face=verdana size=1><<</font></a> ";
    else
    echo "<a class=but href=?process=yesterday&yesterday=vlk&sayfa=$linksayfa><font face=verdana size=2><<</font></a> ";
    }
    }

    }
    echo "
    <SELECT class=pagis onchange=\"jm('self',this,0);\" name=sayfa>";
    for ($i=1;$i<=$tyeni;$i++) {

    if ($sayfa == $i) {
    if ($yesterday)
    echo " <OPTION value=sozluk.php?process=yesterday&yesterday=vlk&sayfa=$i selected>$i</OPTION>";
    else
    echo " <OPTION value=sozluk.php?process=yesterday&sayfa=$i selected>$i</OPTION>";
    } // if
    else {
    if ($yesterday)
    echo "<OPTION value=sozluk.php?process=yesterday&yesterday=vlk&sayfa=$i>$i</OPTION>";
    else
    echo "<OPTION value=sozluk.php?process=yesterday&sayfa=$i>$i</OPTION>";
    } // new

    }
    echo "</SELECT> / $tyeni ";

    if ($sayfa >= 1 or !$sayfa) {
    if (!$sayfa)
    $sayfa = 1;

    $linksayfa = $sayfa + 1;

    if ($linksayfa <= $tyeni) {
    if (!$yesterday)
    echo " <a class=but href=?process=yesterday&sayfa=$linksayfa><font face=verdana size=1>>></font></a>";
    else
    echo " <a class=but href=?process=yesterday&yesterday=vlk&sayfa=$linksayfa><font face=verdana size=1>>></font></a>";
    }

    }


    }

    echo "</div><hr>";
    ?>

  2. #2
    SitePoint Wizard bronze trophy Kailash Badu's Avatar
    Join Date
    Nov 2005
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What do you mean by code doesn't work up to 10th of a month. What happens? What behavior you expect?

  3. #3
    SitePoint Member
    Join Date
    Feb 2007
    Location
    Denizli, Turkey
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i want this code to take entries which was written yesterday, but it doesn't work for first 10 day of a month.

  4. #4
    SitePoint Member
    Join Date
    Feb 2007
    Location
    Denizli, Turkey
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    are there anyone to solve this problem


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •