PCinvent.info

PCinvent Studio Template

Jul 24 2009
date() of returning 12-31-1969 Print E-mail
Friday, 24 July 2009


Read More Articles in: Technology>>>Programming

This Article is written by This e-mail address is being protected from spam bots, you need JavaScript enabled to view it


If your PHP call of MySQL table returnning 12-31-1969, don't even think you got the SQL correct and table selected,but just there is something wrong with PHP code you wrote. In most case, it is that you echo the table without selecting it in your SQL.

e.g.: date('m-d-Y', $row["last_post"] )

And your SQL is   $search_query = "SELECT a.id, a.poster, a.first_post_id, a.subject, a.num_views, a.num_replies, b.id,  b.topic_id FROM a, b";

You have whole bounch of select query, but look at it, you don't even have something called "a.last_post" or "b.last_post" for this Left Join SQL.This is a very common mistake that one will make. And PHP date() function doesn't return Null or False value really gonna confuse us and assume there is no problem in the SQL.

So if you insert Select last_post, the problem will be fixed immediately.

Comments (1)Add Comment
...
written by ajaxer, July 29, 2009
oh thanks a lot. made the exactly same mistake.. smilies/grin.gif

Write comment
quote
bold
italicize
underline
strike
url
image
quote
quote
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley

busy
Tags:  Technology Programming date() of returning 12-31-1969 PHP Date function Date Function 12-31-1969
Last Updated ( Thursday, 30 July 2009 )
 
< Prev   Next >
Unlimited Phone Service $14.95
Site by PCinvent.com