Bug #58636 system Error reports while coloumn name = Dec (December)

Submitted: 1 Dec 2010 18:36 Modified: 1 Dec 2010 20:54
Reporter: Eli Cohen Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:5.0.91 OS:Linux
Assigned to: CPU Architecture:Any
Tags: change, dec, error, UPDATE

[1 Dec 2010 18:36] Eli Cohen
Description:
Hi
I have a table with Day_01 to Day_31 and months: Jan thru Dec for my web
Stat counter.
The problem started TODAY Dec 1 2010.

The column name 'Dec' can NOT be SET a value (WHERE 'Dec' = $value), can
NOT be renamed: CHANGE 'Dec' 'Decm' and actually, can NOT be
accessed...
What should I do?
I have over 30 tables.

Thanks.

How to repeat:
UPDATE $table SET 'Dec' = $value  (WHERE 'name' = $name)
or Change 'Dec' = 'New Name'...

$today = "Day_".date("d");
$this_month = date("M");
$currMonth = date("m");
$currYear = date("Y");

mysql_query("UPDATE $table SET hits = $count, this_year = $count_year, $today = $count_today, $this_month = $count_month WHERE (name = '$page')") or die(mysql_error());
[1 Dec 2010 19:03] MySQL Verification Team
Please see: http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html and look for dec.
[1 Dec 2010 19:41] Eli Cohen
Thanks!!

It really helped!

I solved it by adding white space AND quotes.
`Dec` = $value
mysql_query("UPDATE $table SET hits = $count, this_year = $count_year, $today = $count_today, `$this_month` = $count_month WHERE (name = '$page')") or die(mysql_error());

Eli.
[1 Dec 2010 20:54] Sveta Smirnova
Thank you for the feedback.

closed as "Not a Bug" because last comment.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.045 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.