MySQL error
Posted by Steel Rat
MySQL error February 23, 2006 10:59PM |
Registered: 18 years ago Posts: 179 |
Ok, I'm doing a bit of hacking and running into a wall that doesn't make any sense.
Essentially I've added a text field to the phorum_groups table. The field name is desc (for description).
I had no trouble adding the Description textarea to the Edit A Group form using the proper class. And I can retrieve the description from the field and have it display in the textarea when going into edit mode. The problem is when updating the group when I have the desc field in the SQL update statement.
In the mysql.php file, phorum_db_save_group function, I added one field to the update. So the update line looks like this:
$sql="update {$PHORUM['groups_table']} set name='{$group['name']}', open={$group['open']}, desc='{$group['desc']}' where group_id={$group['group_id']}";
The part I added is:
, desc='{$group['desc']}'
Which is identical in syntax to the name set.
I always get an unspecified syntax error from the SQL execution. I've gone over it and over it, and can't figure out why. The syntax is correct. The only thing I can think of is that Phorum is somehow not liking a new field being added, but isn't telling me why. I have confirmed via debug statements that the $group["desc"] element is getting the data from the form post, and that the SQL statement is also getting the proper data.
For the table field, I've used the text, mediumtext, and longtext data types, but all of them react the same way.
Any ideas?
Steel Rat
[infinite-realities.com]
Essentially I've added a text field to the phorum_groups table. The field name is desc (for description).
I had no trouble adding the Description textarea to the Edit A Group form using the proper class. And I can retrieve the description from the field and have it display in the textarea when going into edit mode. The problem is when updating the group when I have the desc field in the SQL update statement.
In the mysql.php file, phorum_db_save_group function, I added one field to the update. So the update line looks like this:
$sql="update {$PHORUM['groups_table']} set name='{$group['name']}', open={$group['open']}, desc='{$group['desc']}' where group_id={$group['group_id']}";
The part I added is:
, desc='{$group['desc']}'
Which is identical in syntax to the name set.
I always get an unspecified syntax error from the SQL execution. I've gone over it and over it, and can't figure out why. The syntax is correct. The only thing I can think of is that Phorum is somehow not liking a new field being added, but isn't telling me why. I have confirmed via debug statements that the $group["desc"] element is getting the data from the form post, and that the SQL statement is also getting the proper data.
For the table field, I've used the text, mediumtext, and longtext data types, but all of them react the same way.
Any ideas?
Steel Rat
[infinite-realities.com]
Re: MySQL error February 24, 2006 02:27AM |
Admin Registered: 21 years ago Posts: 9,240 |
Re: MySQL error February 24, 2006 01:16PM |
Registered: 18 years ago Posts: 179 |
Here is the MySQL error (hehe, wish you guys had BBCode activated):
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc='Red Dwarf Game 1' where group_id=3' at line 1
And here is the actual SQL query as reported with a debug statement:
update phorum_groups set name='Red Dwarf: Smeg Off!', open=0, desc='Red Dwarf Game 1' where group_id=3
Steel Rat
[infinite-realities.com]
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc='Red Dwarf Game 1' where group_id=3' at line 1
And here is the actual SQL query as reported with a debug statement:
update phorum_groups set name='Red Dwarf: Smeg Off!', open=0, desc='Red Dwarf Game 1' where group_id=3
Steel Rat
[infinite-realities.com]
Re: MySQL error February 24, 2006 01:24PM |
Admin Registered: 21 years ago Posts: 9,240 |
Re: MySQL error February 24, 2006 01:32PM |
Registered: 18 years ago Posts: 179 |
Wow, really? I've used it numerous times before. At least I thought I had. Come to think of it I might have used things like short_desc or long_desc.
Thanks for that, though, I'll see if that works.
Steel Rat
[infinite-realities.com]
Thanks for that, though, I'll see if that works.
Steel Rat
[infinite-realities.com]
Re: MySQL error February 24, 2006 01:48PM |
Registered: 18 years ago Posts: 179 |
Re: MySQL error February 24, 2006 01:55PM |
Registered: 18 years ago Posts: 179 |
Re: MySQL error March 01, 2006 04:06PM |
Admin Registered: 23 years ago Posts: 4,495 |
MySQL 4.1 and up got strict on reserved words. You can still use it, but you have to surround it with back tics `desc`
Brian - Cowboy Ninja Coder - Personal Blog - Twitter
Sorry, only registered users may post in this forum.