Link to home
Start Free TrialLog in
Avatar of Bruce Gust
Bruce GustFlag for United States of America

asked on

Why is this date not being inserted correctly?

I'm doing a basic insert statement after having scraped the data from a webpage.

When I go to insert the date, I repeatedly get "0000-00-00."

I'm grabbing the data using getElementsByTagName and it prints as 12/04/2014. But when I go to insert it into the database, it's not processing it correctly.

I figured it had to be something related to the way I was attempting to insert a string when MySQL needed a date, so I did this:

$date=date("m/d/Y", strtotime($cols->item(0)->nodeValue));

I echo-ed it, just to make sure I was barking up the right tree, and it still goes into the database as 0000-00-00.

What am I missing?
ASKER CERTIFIED SOLUTION
Avatar of Gary
Gary
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bruce Gust

ASKER

Gary, you're the man!

Had to go back and put my $date dynamic within my insert statement within "' '", but once that was in place an exasperating scenario was remedied!

Rock on!