phpMyEdit - Rozšírené detaily chyby [ Späť ]
146 core / general triviálna vždy 2003-12-15 20:36 2004-02-20 13:12
Feike  
nepto  
normálna  
uzavretý current from CVS  
duplicitný  
žiadny 0000094  
žiadny  
Can't use group as column name
I have a table with a column name 'group' in it. But when I want to update this table, phpMyEdit gives an error.
1. Create a table with a column-name named 'group'
2. Try to update, or insert a field.
I found out that in an query the column names are not quoted. For example:
SELECT id,group FROM groups WHERE id='424';
will not work because of 'group' as in GROUP BY. It will work if the column names are quoted, as in:
SELECT 'id', 'group' FROM groups WHERE id='424';
0000146-backquotes.diff.txt (1 KB) 1970-01-01 01:33

Poznámky k chybe
nepto   
2003-12-16 11:18   
Yes, we know about this issue.

This could be probably solved by quoting column/table/etc names.

Thank you for reporting!
Feike   
2003-12-16 13:04   
Okay, sorry about that, I just saw that bug-report.

It says how to quote table names, but how do I quote field names?
michal   
2003-12-21 12:07   
if field name is the same as column name, then should be quoted the same way (`field_name`)(the quote below esc button).

without quoting, apps will break in these cases:
column names are reserved words, like group, select, limit, and, column, ...
column names containing . (dot) and -(minus)
(and probably more cases)
hbernard   
2003-12-21 12:23   
There is a workaround for this :
just put the field's name into backquotes.

like this : $opts['fdd']['`group`']

This needs a FAQ entry, or a comment about field definition.

BUT, this break javascript validation. (backquotes doesn't seem to be a valid javascript character)

patch backquotes.diff fix this by removing backquotes in field names wrote in javascript.
nepto   
2004-01-23 17:01   
This is a duplicated entry.