PHP Experience

adelphia hawkwynd at adelphia.net
Wed Oct 27 20:24:21 EDT 2004


Hi Tim,

    I'm working on my first mySql project. I have a web form, for inserting
a date field into mySql.
The field in the table is set to timestamp in mySql.

I prepare the data for insert with:

    list($month, $day, $year) = split('[/.-]', $_POST['Event_Date_Start']);
    $Event_Date_Start = $year."-".$month."-".$day;

And it is stored in mySql as "20041027164404"

I query the records, and recall the Event_Date_Start record to display on
the page:

    $num=mysql_numrows($result);
    $i=0;
    while ($i < $num) {
         $Event_Date_Start=mysql_result($result,$i,"Event_Date_Start");
         echo date("l, F j, Y",$Event_Date_Start)." at ".$Event_Time_Start;
    }

Now, here's the result:
        Monday, January 18, 2038


    It's an incorrect date.It should be Saturday, November 27, 2004. I'm
stumped, after perusing through pages and pages of PHP manuals, there's
little reference to fix this with mySql and php.. Any help with this would
be appreciated...

    PS: it's not any better using  date("l, F j,
Y",strtotime($Event_Date_Start));

Any thoughts?

Scott




----- Original Message ----- 
From: "Timothy J. Finucane" <speljamr at speljamr.com>
To: <nflug at nflug.org>
Sent: Wednesday, October 27, 2004 7:52 PM
Subject: Re: PHP Experience


I have a good amount of experience with PHP/MySQL. What kind of
assistance do you require?

Tim




More information about the nflug mailing list