Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Add/Edit in Admin mode not working if alias for table has been specified

Add/Edit in Admin mode not working if alias for table has been specified 3 months 2 weeks ago #5438

  • alk
  • alk's Avatar Topic Author
  • Offline
  • Posts: 3
  • Thank you received: 0
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

Please Log in or Create an account to join the conversation.

Add/Edit in Admin mode not working if alias for table has been specified 3 months 2 weeks ago #5439

  • Dirk
  • Dirk's Avatar
  • Offline
  • Posts: 1108
  • Karma: 21
  • Thank you received: 201

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 or Create an account to join the conversation.

Add/Edit in Admin mode not working if alias for table has been specified 3 months 2 weeks ago #5440

  • alk
  • alk's Avatar Topic Author
  • Offline
  • Posts: 3
  • Thank you received: 0

Dirk wrote: ... because my alias field is always alias!

I almost thought so. ;)

/alk

Please Log in or Create an account to join the conversation.

Add/Edit in Admin mode not working if alias for table has been specified 3 months 2 weeks ago #5441

  • alk
  • alk's Avatar Topic Author
  • Offline
  • Posts: 3
  • Thank you received: 0

Dirk wrote:

.$db->eacape($falias)


Typo alert above!

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Moderators: Dirkjoest