| Bug #58775 | Table Field Name - Group | ||
|---|---|---|---|
| Submitted: | 7 Dec 2010 0:55 | Modified: | 7 Dec 2010 4:19 |
| Reporter: | Adam Alicki | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | MySQL Server: Errors | Severity: | S3 (Non-critical) |
| Version: | 5.1.52 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | Fetch Array Error, Field Name, GROUP | ||
[7 Dec 2010 4:19]
Valeriy Kravchuk
GROUP is a reserved word in MySQL, so it should be quoted when used as identifier. Read http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html.

Description: No table can contain a field with the name 'group'. Although you are allowed to create such a field with the name, calling contents from a table with the field 'group' will always result in a mysql_fetch_array error, claiming the resource does not exist. This is a naming convention bug rather than a software conflict. How to repeat: Create a table with two fields, id and group. Fill the table with sample data (eg: 1, testgroup one). Call the table information, $query = mysql_query("SELECT * FROM table WHERE group = '$group'"); while ($rows = mysql_fetch_array($load_groupMembers)){ echo "$rows[group]"; } Suggested fix: Not sure of a suggested fix, other than for the developer to extend the name of the field, ie; group should become group_name or group_row