SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 28 of 28
  1. #26
    SitePoint Zealot moshe_be's Avatar
    Join Date
    Dec 2000
    Posts
    169
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by ibeblunt
    I meant I have to convert my dates and times to UnixTimeStamps. As of now I'm using just regular dates (ie 2001/03/23). Any more ideas?
    You don't have to use UNIX_TIMESTAMP. that depends on the format of your $curdate as I put that on the example.

    Obviously you have the time/date of the current article either on MySQL date format or Unix timestamp (for displaying the date). You can compare the dates on the query.

    You can use:
    Getting the $curdate from the current table row.
    $curdate = $row['articleDate'];

    $NextLink = mysql_query('SELECT articleID from articles WHERE articleDate > ' . $curdate . ' LIMIT 1');

  2. #27
    SitePoint Enthusiast Jack@dwd.com's Avatar
    Join Date
    Dec 2000
    Location
    UK
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just use int(10) fields and store the value returned by the php function time() directly. Then just repull it from the db, no need for UNIX_TIMESTAMP(date) as date anymore. Hope that helps.

  3. #28
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Jack as a sidenote, by storing your dates in date columns you thereby have access to all of MySQL date functions for comparing adding subtracting, days weeks, years, its all there. When you store it in int(10) field you no longer have access to all those functions. Sure you can do it in PHP but then php gets bogged down, it an be done much eaiser and faster in the query itself.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.


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
  •