Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Help with a date

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Help with a date

Postby NateNWI » Tue Mar 04, 2003 5:59 am

HI everyone. I'm new to this PHP thing and having a problem with a date. On the site, a user will select their DOB by choosing from 3 dropdowns. I'm sending the date to the DB using:
Code: Select all
$datestamp = mktime(0,0,0,$selDate,$Month,$year);
$DOB = getdate($datestamp);

This gets me a Type Mismatch Error. Any ideas?
NateNWI
New php-forum User
New php-forum User
 
Posts: 2
Joined: Tue Mar 04, 2003 5:55 am

Re: Help with a date

Postby WiZARD » Tue Mar 04, 2003 7:33 am

What is it?
$selDate
$Month
$year
User avatar
WiZARD
Moderator
Moderator
 
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol

Postby Elena Mitovska » Tue Mar 04, 2003 7:41 am

The order of parameter for mktime command is
mktime(hour, minute, second, month, day, year)
it seems you confused the palces of $month and $date

in your code $date is set to palce for $month.
Probably that is the error
Elena Mitovska
New php-forum User
New php-forum User
 
Posts: 13
Joined: Tue Nov 12, 2002 12:11 pm
Location: Ukraine

Postby NateNWI » Tue Mar 04, 2003 8:59 am

Thanks. I've made the changes, but it won't perform the getdate function on $datestamp. Any ideas?
NateNWI
New php-forum User
New php-forum User
 
Posts: 2
Joined: Tue Mar 04, 2003 5:55 am

Postby pootergeist » Tue Mar 04, 2003 9:34 am

tried just echoing $datestamp yet?

also - are you declaring your variables from the $_POST array prior to calling?

$datestamp = mktime(0,0,0,$_POST['Month'],$_POST['selDate'],$_POST['year']);

other than that, just check case sensitivity of all fields.
pootergeist
New php-forum User
New php-forum User
 
Posts: 191
Joined: Wed Jan 29, 2003 7:11 am
Location: UK


Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.