Jump to content


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

set_relation different_databases mysql

  • Please log in to reply
1 reply to this topic

#1 fede72bari

fede72bari

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 15 May 2020 - 03: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



#2 fede72bari

fede72bari

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 20 May 2020 - 01:44 PM

nobody has any idea? :-)







Also tagged with one or more of these keywords: set_relation, different_databases, mysql

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users