Need Help about time difference

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Need Help about time difference

    Hi,

    I can't explain this on the title. sorry for that. What I need is: On my mysql there are several news published in the morning. each comes one after another and sometimes at the same time. I want that it will differentiate with current times with the news time and will highlight the upcoming news.
    My mySQL table data's are given below:

    PHP Code:
    while...
    echo 
    "<ul style='newsrow'>;
    {
    echo "
    <li>".$row['date']." ".$row['time']." ".$row['news']."</li>";
    }
    echo "
    </ul>"; 
    Can any one help me on this?

    Regards

    #2
    Sql code ? Post here

    Comment


      #3
      Originally posted by pichiriche View Post
      Sql code ? Post here
      PHP Code:
      $result mysql_query("SELECT * FROM `newsline` WHERE date='$data' order by time asc");
      while (
      $row mysql_fetch_array($result)) {
      echo 
      "<ul style='newsrow'>";

            echo 
      "<li>".$row['date']." - ".$row['time']." - ".$row['news']."</li>"

      echo 
      "</ul>"
      Last edited by asifnayem; 14.03.13, 18:54.

      Comment


        #4
        Can anyone help me out on this??

        Comment


          #5
          This is a bit complicated as idea.
          Why not store the date in a timestamp format? Then you can select passed ones, or coming next ones, etc.
          mysterio.al - programming is a functional art

          Comment


            #6
            Well, if I can save the time as timestamp format but still, I don't have any idea how to highlight the next news?

            Comment


              #7
              WHERE date='$data'
              AND date>date();
              ORDER BY time DESC
              LIMIT 1; ?
              Last edited by Vayne; 19.03.13, 22:24.
              Nous Ne Dansos Pas, Nous Sommes Le Danse.!

              Comment

              Working...
              X