Jump to content

tomhoad

Members
  • Posts

    52
  • Joined

  • Last visited

    Never

Everything posted by tomhoad

  1. I can't seem to search the forums at the moment, so apologies if there is another thread addressing my problem. According to phpMyAdmin, the text from a text box is being stored correctly, line breaks 'n' all. However, upon echoing the data, the "content" is printed on one line. <?php include 'secure/config.php'; include 'secure/opendb.php'; $query = "SELECT id, title, content, FROM_UNIXTIME(date, '%W %D %M %Y at %h:%i %p') as dttm FROM news ORDER BY id DESC LIMIT 3"; $result = mysql_query($query) or die('Error : ' . mysql_error()); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $title = $row['title']; $content = $row['content']; $dttm = $row['dttm']; echo stripslashes ( ' <p class="news-header">'.$title.'</p> <p class="news-body">'.$content.'</p> <p class="news-footer">Posted on: '.$dttm.'</p> <br> ' ); } ?> What have I missed out? thank you
  2. Hi, Long time since I've done PHP programming - PHP5 has come out since... Anyway, I'm having some trouble echoing a UNIX TIMESTAMP from my database. The timestamp is getting there fine, phpmyadmin is saying so, in the format 2007-21-11 23:27:00 etc. However, when I recall this from the database with... $query = "SELECT title, content, FROM_UNIXTIME(date, '%W %D %M %Y') as dttm FROM news ORDER BY date"; ...I get the date as "Wednesday 31st December 1969". Which unless I've gone back in time, is not the date. Any help appreciated! I've heard there's quirks in how php5 now deals with time queries compared to php4, so maybe im just not up to date - or maybe im just plain wrong! Cheers!!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.