I have a MySQL table which records data (clicks on links, as it happens, but I don't think that has anything to do with my problem). The table has columns for each month, named 'jan', 'feb', ....'nov', 'dec'. Everything has been working perfectly since May, until we got to December. I find that nothing gets recorded in my column named 'dec', but if I name it something else (say, 'Decm') there's no longer any problem. (Although 'Dec' doesn't work).
Two crucial lines of code are:-
$month = strtolower(date("M")); //Sets month column for click (e.g. 'jan')
this suits the column names I've chosen, so resorting to 'Decm' would be a pain. And:
$query1= "UPDATE memclicks SET $month=$month+1 where bus_id =" . $_GET['id'];
Here the same '$month' variable represents the VALUE in the field, which is incremented by 1.
As said, this has worked fine for all months May-Nov (and for Jan too), but NOT 'dec'. However, if I put back-ticks around the $month variable, it DOES work for 'dec' :-
$query1= "UPDATE memclicks SET `$month`=`$month`+1 where bus_id =" . $_GET['id'];
Which is why I wonder if 'dec' is a reserved word ? Or is there something else ?
Best Wishes for the New Year, everyone.
Did you find it in the reserved words section of the mysql manual?
Yes, I did find it when I followed your link. I wasn't sure where to look before. So quite clearly 'dec' IS a reserved word, and will remain so.
No more to be said !