Reputation: 5
I'm running into a weird issue where I'm posting a date in Y-m-d
format yet it's being changed to a completely different date once I view in the actual MySQL table.
Here's the query
UPDATE $admins_table
SET expire=$expireu
WHERE identity='$donation_row[steam_id]
The expire field is what I'm having issues with. The field itself is a varchar, and the $expireu variable is always a date in Y-m-d
format ex. 2013-11-16
When that query is run, with the date I gave as an example above, I get a weird result in the actual MySQL table. If I go to view the table, instead of it storing 2013-11-16
it has stored 1986
as the date. No month or day, just 1986
.
I may have made a very stupid/silly mistake, but at this point I'm unsure of what I've flubbed. Any help in the right direction would be much appreciated, thank you.
Upvotes: 0
Views: 82
Reputation: 456
the use of ' and " are your friends. you are passing a math problem into mysql which it is solving and then saving the result of. wrap that date in quotes.
Upvotes: 0
Reputation: 850
haha, use quotes!
UPDATE $admins_table SET expire='$expireu' WHERE identity='$donation_row[steam_id]'
mysql substracts 2013-11-16 == 1986
Upvotes: 5