PDOStatement::execute() Invalid datetime - but not a datetime field

Codes here !

Moderators: gesf, Michalio

Post Reply
User avatar
ajaxStardust
New php-forum User
New php-forum User
Posts: 12
Joined: Fri Jul 08, 2022 3:10 am

Hello all. Hope you are well.

Please have a look at this screenshot. I'm trying to fix this error, but the error doesn't make sense to me. At first, I thought I had it-- as the database field was Int, and the app is passing an alphnum string. I changed the field from int, text which didn't work, then to varchar, which also doesn't work.

Image
https://i.imgur.com/7KbU5V0.png


I suspect it has to do with the[ GeoLib framework they're using ](http://geotonics.com/doc/geolib/). (same org, if i've posted about the apple farm here in the past... ugh... )

I haven't figured out where in that library it might be thinking that needs to be a datetime field. This thing is crazy: they have it set up w/ an MS Access DB on a PC in their office where they can scan pallet label barcodes into their .mdb prior to shipping. Then, once they update the local .mdb, it's setup to send a query to their MySQL... get this... wordpress database, remote. And they're using that GeoLib thing to do the database abstraction, though the docs explicitly state it has no abstraction layer. (don't ask, 'cause i have no idea. lol')

I just need to figure out why it's throwing that datatime error. I'm not a PDO expert, so your help is greatly appreciated.
User avatar
Michalio
Moderator
Moderator
Posts: 317
Joined: Sun Jul 18, 2021 1:33 pm
Location: Poland

Can you post the entire query?
What type of column do you have already?
This is your code or code of the lib?
Free coding lessons: https://php-forum.com/phpforum/viewtopic.php?t=29852
User avatar
ajaxStardust
New php-forum User
New php-forum User
Posts: 12
Joined: Fri Jul 08, 2022 3:10 am

Hi there. Thank you for replying to this. I'm sorry, I was at work (doint this "from work") and didn't realize I'd gotten a notification of reply on this. I solved the problem. It was due to the database field was not accepting alphanum, but the data being sent was alphanum. so i changed the type to varchar and i was good to go!

I thought changing it wasn't working, but the way that app is setup, they have an .mdb database talking to a Wordpress database. plus a staging server and a production server. i'd made the changes to the wrong server / data source name in the code.

Thanks again!
:)
Post Reply