FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » problem saving date fields
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: problem saving date fields [message #174168 is a reply to message #174164] Mon, 23 May 2011 22:01 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 5/23/2011 5:26 PM, Co wrote:
> On 23 mei, 19:27, Co<vonclausow...@gmail.com> wrote:
>> On 23 mei, 13:13, Jerry Stuckle<jstuck...@attglobal.net> wrote:
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>> On 5/23/2011 12:51 AM, Co wrote:
>>
>>>> > ==================
>>
>>>> Wow you guys really love each other.
>>
>>>> Marco
>>
>>> Yea, unfortunately, you have to put up with some trolls on usenet.
>>
>>> --
>>> ==================
>>> Remove the "x" from my email address
>>> Jerry Stuckle
>>> JDS Computer Training Corp.
>>> jstuck...@attglobal.net
>>> ==================
>>
>> So when one of the three dates is not changed it returns the month
>> written.
>> Than this code:
>> $arrival_month = preg_replace('#[^0-9]#i', '',
>> $_POST['arrival_month']);
>> ruins the date and it gets set back to 00-00-0000.
>> Is there a way to detect changes? because than I could set an if
>> statement before
>> running the UPDATE query and we leave out the dates that were not
>> changed.
>>
>> Marco
>
> Guys,
>
> I solved the problem.
> Maybe not the nicest way but it is working.
> Here is the code:
>
> $num_arrival_month = "";
> $arrival_month = $_POST['arrival_month'];
> if(!is_numeric($arrival_month)) {
>
> for($i=1;$i<=12;$i++){
> if(date("F", mktime(0, 0, 0, $i, 1, 0)) == $arrival_month){
> $num_arrival_month = $i;
> break;
> }
> }
> } else {
> $num_arrival_month = $arrival_month;
> }
>
> $arrival_day = preg_replace('#[^0-9]#i', '', $_POST['arrival_day']);
> $arrival_year = preg_replace('#[^0-9]#i', '',
> $_POST['arrival_year']);
> $arrival_date = "$arrival_year-$num_arrival_month-$arrival_day";
>
>
> Any comments?
>
> Marco

No, you will be much better off learning to use the SELECT element
properly, as I indicated before. Look for some HTML tutorials.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: is dis da place?
Next Topic: foreach in reverse
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 28 12:06:22 GMT 2024

Total time taken to generate the page: 0.04148 seconds