Forums

This topic is locked

Submitting hidden date in form

Posted 30 Jan 2005 15:56:18
1
has voted
30 Jan 2005 15:56:18 Matthew Hartwell posted:
Ive been using

<input type="hidden" name="date" value="<?php (date("m/d/Y, h:s A"); ?>">

in my form to submit the date. The date field in my table is TIMESTAMP(14) and it stores it fine.

I actually just want to display the date like 20th January 2005, but after reading several examples on these forums and using differant functions like mktime

I can format the output of the query like

$query_rs_dateadded = "SELECT DATE_FORMAT(date,'%d %M %Y') as date FROM table";

and all the dates appear the same. I know someone else mentioned the problem, but i couldnt get the solution to work.

Exactly what will work for PHP and MySQL in very very laymans terms lol

Replies

Replied 30 Jan 2005 21:05:23
30 Jan 2005 21:05:23 Chris Charlton replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>...I actually just want to display the date like 20th January 2005...<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

I have a tutorial on <i>Server Formats</i> which may be your answer: www.dmxzone.com/showDetail.asp?TypeId=28&NewsId=7613
Replied 31 Jan 2005 09:42:44
31 Jan 2005 09:42:44 Matthew Hartwell replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>...I actually just want to display the date like 20th January 2005...<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

I have a tutorial on <i>Server Formats</i> which may be your answer: www.dmxzone.com/showDetail.asp?TypeId=28&NewsId=7613
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Ya i have the date/time extension installed but it always shows every date the same value.

ie Saturday 31st January 2005 10 times for all date output.

Its either the way its being parsed to the database using that php date function or im not using the correct date type in the database.

Im sure this problem has come across a billion times. Too many damn date options and lack of a common standard among databases in general data use.
Replied 31 Jan 2005 21:27:57
31 Jan 2005 21:27:57 Chris Charlton replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>I actually just want to display the date like 20th January 2005, but after reading several examples on these forums and using differant functions like mktime. I can format the output of the query like:
$query_rs_dateadded = "SELECT DATE_FORMAT(date,'%d %M %Y') as date FROM table"; and all the dates appear the same...<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
I use <i>DATE_FORMAT()</i> function myself, had less headaches usually... for me anyway.

As for the dates all appearing as "Saturday 31st January 2005", have you double-checked what data is in your TIMESTAMP columns? Is only a first record that date, or are allll of them that date (in the DB)?
Replied 02 Feb 2005 05:33:14
02 Feb 2005 05:33:14 Matthew Hartwell replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>I actually just want to display the date like 20th January 2005, but after reading several examples on these forums and using differant functions like mktime. I can format the output of the query like:
$query_rs_dateadded = "SELECT DATE_FORMAT(date,'%d %M %Y') as date FROM table"; and all the dates appear the same...<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
I use <i>DATE_FORMAT()</i> function myself, had less headaches usually... for me anyway.

As for the dates all appearing as "Saturday 31st January 2005", have you double-checked what data is in your TIMESTAMP columns? Is only a first record that date, or are allll of them that date (in the DB)?
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

They are differant, 3 differant dates, but they come up as the first one i entered 2005-01-31
Replied 02 Feb 2005 07:37:11
02 Feb 2005 07:37:11 Matthew Hartwell replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>I actually just want to display the date like 20th January 2005, but after reading several examples on these forums and using differant functions like mktime. I can format the output of the query like:
$query_rs_dateadded = "SELECT DATE_FORMAT(date,'%d %M %Y') as date FROM table"; and all the dates appear the same...<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
I use <i>DATE_FORMAT()</i> function myself, had less headaches usually... for me anyway.

As for the dates all appearing as "Saturday 31st January 2005", have you double-checked what data is in your TIMESTAMP columns? Is only a first record that date, or are allll of them that date (in the DB)?
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

They are differant, 3 differant dates, but they come up as the first one i entered 2005-01-31
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Ive posted in macromedia forums. I can see im gonna have to buy a commercial extension or something to get this to work, either that or forget about dates all together. Unfortunately im sure ill need them at some point.
Replied 02 Feb 2005 19:33:20
02 Feb 2005 19:33:20 Chris Charlton replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote><BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>As for the dates all appearing as "Saturday 31st January 2005", have you double-checked what data is in your TIMESTAMP columns? Is only a first record that date, or are allll of them that date (in the DB)?<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
They are differant, 3 differant dates, but they come up as the first one i entered 2005-01-31<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Can you post a dev/sample page for us to see. Because it sounds like a Recordset cursor issue, not moving to the next record (to show other dates). Is other data coming down with the dates (text)? If so, are those only showing the 1st also?
Replied 03 Feb 2005 00:34:45
03 Feb 2005 00:34:45 Matthew Hartwell replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote><BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>As for the dates all appearing as "Saturday 31st January 2005", have you double-checked what data is in your TIMESTAMP columns? Is only a first record that date, or are allll of them that date (in the DB)?<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
They are differant, 3 differant dates, but they come up as the first one i entered 2005-01-31<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Can you post a dev/sample page for us to see. Because it sounds like a Recordset cursor issue, not moving to the next record (to show other dates). Is other data coming down with the dates (text)? If so, are those only showing the 1st also?
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Hi Chris,

All the other fields in my database display perfectly with no problems, its just date thats causing issues. I got a response from my query over at macromedia.

This is the thread www.macromedia.com/cfusion/webforums/forum/messageview.cfm?catid=263&threadid=954360&enterthread=y

But wherever i put &lt;?php echo date("F jS Y",strtotime($row_rs_dateadded['myDate']); ?&gt; i get a blank page. So i put that on anniversary.php, and it makes the entire page blank. I look at the source code, and theres nothing in between the &lt;body&gt; tags.

Is it because im calling that PHP function. Either way it doesnt like it...hope to hear back from the poster on that one.
Replied 03 Feb 2005 00:51:09
03 Feb 2005 00:51:09 Matthew Hartwell replied:
So just to give you a total overall view of what i have now

The "myDate" field setup in the table is of type "DATE/TIME"
I am getting perfect dates like 2005-02-03 08:53:17 in there.

On my addgifts.php i have:

GetSQLValueString($_POST['myDate'], "text", - in my insert statemnt
&lt;input type="hidden" name="myDate" value="&lt;?php echo date('Y-m-d H:i:s');?&gt;"&gt; - as my hidden input

On anniversary.php i have:

$query_rs_dateadded = "SELECT myDate FROM gifts"; - as my select statement
&lt;?php echo $row_rs_dateadded['myDate']; ?&gt; - as my php output code

Now the only thing differant to is the other suggested this:

&lt;?php echo date("F jS Y",strtotime($row_rs_dateadded['myDate']); ?&gt; - as my php output code

But as i said that gives me a blank page with nothing inbetween the &lt;body&gt; tags.

Hope that clears up where im at at this point. Vince helped me get the UPDATE thing working so thats 1 down hehe.

Reply to this topic