Add/Edit in Admin mode not working if alias for table has been specified
- alk
- Topic Author
- Offline
Less
More
- Posts: 3
- Thank you received: 0
5 years 1 month ago #5438
by alk
Add/Edit in Admin mode not working if alias for table has been specified was created by alk
Hello Team
Using v3.9.7, if trying to save an edited DB record from the admin-view for a DB-table with an alias set, I get:
1054 Unknown column 'alias' in 'where clause'
I do not expercience this error if no alias is set for the DB-table.
Looking into the code of:
administrator/components/com_joodb/helpers/form.php
I feel in function checkAlias() this line:
$db->setQuery("SELECT `".$jb->fid."` FROM `".$jb->table."` WHERE alias=".$db->quote($item->{$falias}));
should look like this:
$db->setQuery("SELECT `".$jb->fid."` FROM `".$jb->table."` WHERE $falias=".$db->quote($item->{$falias}));
At least the above change fixed the error. ;)
Cheers/Tschüss
/alk
Using v3.9.7, if trying to save an edited DB record from the admin-view for a DB-table with an alias set, I get:
1054 Unknown column 'alias' in 'where clause'
I do not expercience this error if no alias is set for the DB-table.
Looking into the code of:
administrator/components/com_joodb/helpers/form.php
I feel in function checkAlias() this line:
$db->setQuery("SELECT `".$jb->fid."` FROM `".$jb->table."` WHERE alias=".$db->quote($item->{$falias}));
should look like this:
$db->setQuery("SELECT `".$jb->fid."` FROM `".$jb->table."` WHERE $falias=".$db->quote($item->{$falias}));
At least the above change fixed the error. ;)
Cheers/Tschüss
/alk
Please Log in to join the conversation.
- Dirk
-
- Offline
Less
More
- Posts: 1222
- Thank you received: 226
5 years 1 month ago #5439
by Dirk
Thank you for reporting this bug. I never recognized it because my alias field is always alias!
But I wouldn't write variables directly in the SQL String and escape the variable..
Replied by Dirk on topic Add/Edit in Admin mode not working if alias for table has been specified
alk wrote: $db->setQuery("SELECT `".$jb->fid."` FROM `".$jb->table."` WHERE $falias=".$db->quote($item->{$falias}));
Thank you for reporting this bug. I never recognized it because my alias field is always alias!
But I wouldn't write variables directly in the SQL String and escape the variable..
$db->setQuery("SELECT `".$jb->fid."` FROM `".$jb->table."` WHERE `".$db->eacape($falias)."`=".$db->quote($item->{$falias}));
Please Log in to join the conversation.
- alk
- Topic Author
- Offline
Less
More
- Posts: 3
- Thank you received: 0
5 years 1 month ago #5440
by alk
/alk
Replied by alk on topic Add/Edit in Admin mode not working if alias for table has been specified
I almost thought so. ;)Dirk wrote: ... because my alias field is always alias!
/alk
Please Log in to join the conversation.
- alk
- Topic Author
- Offline
Less
More
- Posts: 3
- Thank you received: 0
5 years 1 month ago #5441
by alk
Typo alert above!
Replied by alk on topic Add/Edit in Admin mode not working if alias for table has been specified
Dirk wrote:
.$db->eacape($falias)
Typo alert above!
Please Log in to join the conversation.
Moderators: Dirk, joest