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 #174164 is a reply to message #174155] Mon, 23 May 2011 21:26 Go to previous messageGo to previous message
Co is currently offline  Co
Messages: 75
Registered: May 2011
Karma:
Member
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
[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: Sun Nov 10 12:28:36 GMT 2024

Total time taken to generate the page: 0.03985 seconds