Re: Re: Dates in QuickForm

From: Date: Mon, 01 Sep 2003 07:12:32 +0000
Subject: Re: Re: Dates in QuickForm
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-7523@lists.php.net to get a copy of this message
<leonie_price@hotmail.com> wrote : > I've worked out that I can get it working using: > > $sql = "select user_id, user_name, email_address, password, user_level, > dayofmonth(expiry_date) as d, month(expiry_date) as M, year(expiry_date) as > Y from users where user_id = '$id'"; > .. > $user = $result->fetchRow(DB_FETCHMODE_ASSOC); > ... > $dates['expiry_date'] = array('d'=>$user['d'], > 'M'=>$user['M'], > 'Y'=>$user['Y']); > $defaults = array_merge($dates, $user); > $form->setDefaults($defaults); > .... > > This isn't very elegant. Is there another way? You can also pass a unix epoch timestamp as a value for the date element. There is a mysql function for that. Bertrand Mansion Mamasam

« previous php.pear.general (#7523) next »