MySQL Insert not working with Date column

Posted by Ian McCullough on Stack Overflow See other posts from Stack Overflow or by Ian McCullough
Published on 2010-06-10T22:41:35Z Indexed on 2010/06/10 22:52 UTC
Read the original article Hit count: 294

Filed under:
|
|

Hello All, I am having an issue with a simple insert query into a table.

I have this PHP Code

$T_MEMBER = "INSERT INTO T_MEMBER (MEMBER_IDENTIFIER,LAST_NAME,FIRST_NAME,BIRTH_DATE) VALUES ('$memberID','$last','$first','$birthdate')";
mysql_query($T_MEMBER) or die(mysql_error());    

Here are a few examples of what the query looks like if i echo it:

INSERT INTO T_MEMBER (MEMBER_IDENTIFIER,LAST_NAME,FIRST_NAME,BIRTH_DATE) VALUES ('2007','Hayes','Karin','1958-30-10') INSERT INTO T_MEMBER (MEMBER_IDENTIFIER,LAST_NAME,FIRST_NAME,BIRTH_DATE) VALUES ('2020','Long','Peggy','1968-29-5') INSERT INTO T_MEMBER (MEMBER_IDENTIFIER,LAST_NAME,FIRST_NAME,BIRTH_DATE) VALUES ('2021','Torres','Diane','1968-30-8')

BIRTH_DATE is a date type column.

The problem is, after i do any of these queries, the date shows up as 000-00-00!!!! I have been wracking my brain and i cannot seem to find the issue.

Thanks, Ian

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql