| Index
» Projects
» phpMyEdit
» Forum
» Errors when changing data in tables with reserved col names |
 |
hallhouse
Joined: 06 Mar 2007
Posts: 2
Posted: 2007-03-06 19:16
Back to top
Reply with quote
|
Is there an easy way to add the ` characters to the feild names for all querys? I have tracked down my problem to being realted to a column name of delete and one by the name of password. I have gone into phpMyEdit.class.php and hacked the function do_change_record with the following changes.
if ($query_real == '') {
$query_real = 'UPDATE '.$this->tb.' SET
`
'.$fd.'
'
='.$value;
} else {
$query_real .= ',
`
'.$fd.'
`
='.$value;
The change being the addition of the ` character before and after the $fd var, it's kinda easy to miss.
Furthermore, even with this addition I still get the errors back from function myquery complaining with the following error;
MySQL error 1064
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 'delete,nextaftercmd,forcename,forcegreetings,hidefromdir FROM voicemail WHERE (u' at line 1
Even though the row is updated correctly now.
However, i'm sure this won't fix it for adds to that table.
|
hallhouse
Joined: 06 Mar 2007
Posts: 2
Posted: 2007-03-08 22:47
Back to top
Reply with quote
|
These field names correspond to functions within the app that is calling the DB. To change the table names would mean a fairly extensive rewrite of the app.
I don't understand why you don't just incorporate the `` tag for all field names. This practice is what is used in phpmyadmin and it is the perfect solution. Using `` circumvents any conflicts between table names and reserverd words in mysql.
???
--scott
|
|
Post new topic
Reply to topic
|
|
|
|