Jump to content


set relation between table to a view

relation view table

  • Please log in to reply
2 replies to this topic

#1 Milfriosc

Milfriosc

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 10 November 2016 - 03:49 PM

Hello,

 

I already see that it's possible to set primary key to make crud for a view but I want to make crud from a table and use set relation with a view.

...
$crud->set_table('my_table');
$crud->columns('id','name','fk_streetcode');
$crud->set_primary_key('id_street','my_view');
$crud->set_relation('fk_streetcode','my_view','streetname',null,'streetname ASC');
...

with this definition there's an data base error

 ... JOIN "my_view" as "j447c7032" ON "j447c7032". = "my_table"."fk_streetcode" ...

you can see that the primary key for the view is not define  : there is a point without id_street >> "j447c7032". =

 

sorry for my english ....

 

Thank's for your answers



#2 Athar

Athar

    Member

  • Members
  • PipPip
  • 13 posts
  • LocationNew York

Posted 13 January 2017 - 03:14 PM

seems like your (relating) fields are NOT "identical" in both tables.


~ I think I think, therefore; I think I exist.


#3 Amit Shah

Amit Shah

    grocery CRUD Master

  • Advanced Member
  • PipPipPip
  • 1,192 posts
  • LocationMumbai, India

Posted 18 January 2017 - 02:24 AM

Hi Milfriosc

Can you dhare the table structure for both so some1 can look @it and suggest you the proper stuff?







Also tagged with one or more of these keywords: relation, view, table

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users