⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

set relations between tables in different databases, same "domain", same databases passwords



fede72bari

fede72bari
  • profile picture
  • Member

Posted 15 May 2020 - 15:24 PM

Good morning,

 

i need to set a relation between the tabloe of a databases and a table of another database. Both the DBs are defiend in the same "domain" and use same credentials. In PHP and codeigniter this case is managed as the two tables are in the same DB, the only precaution is to expolicit the name of the second DB when writing the name of a table: "second_db_name.table_name". I tried to do the same with Gorcery Crud in this way

 

$this->grocery_crud->set_relation('end_users_id','phar263d_PharmaComparisonDB.end_users','{name} ({id})',null,'name ASC');

 

but i got this error

 

Error Number: 1054

Unknown column 'jae9e8d6e.name' in 'field list'

SELECT `user_surveys`.*, CONCAT('', COALESCE(jd0b017c9.name, ''), ' (', COALESCE(jd0b017c9.id, ''), ')') as sd0b017c9, CONCAT('', COALESCE(jae9e8d6e.name, ''), ' (', COALESCE(jae9e8d6e.id, ''), ')') as sae9e8d6e FROM `user_surveys` LEFT JOIN `survey_models` as `jd0b017c9` ON `jd0b017c9`.`id` = `user_surveys`.`survey_models_id` LEFT JOIN `phar263d_PharmaComparisonDB`.`end_users` as `jae9e8d6e` ON `jae9e8d6e`.`id` = `user_surveys`.`end_users_id` LIMIT 10

Filename: models/Grocery_crud_model.php

Line Number: 87

 

I am wronging something? or is there any workaround?

 

Thanks.

 

federico


fede72bari

fede72bari
  • profile picture
  • Member

Posted 20 May 2020 - 13:44 PM

nobody has any idea? :-)