Jump to content


two fields .. two users .. a view

field user table

  • Please log in to reply
8 replies to this topic

#1 Roberto Fabian Rosero Diaz

Roberto Fabian Rosero Diaz

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 01 August 2013 - 04:07 PM

good morning
 
I have a question please help:
 
I have three tables that are:
invoices, cities, departments
 
in the table "invoices" I have these fields:
 
id (pk)
description
value
id_city (Table cities fk)
 
and Table "city" I have these fields:
 
id (pk)
NameCity
id_dpt (fk departments table)
 
and Table "departments":
 
id (pk)
NameDepartament
 
however, in the grocery crud controller, I'm standing on the table "invoices", I have two users: "admin" and "mauro" then the admin user will be entering fields in the table "invoices", including the "NameCity "that I bring to the table" cities ", I want the user" mauro "can see the records that I put the admin user, but this Signature: User, rather than viewing the" NameCity "I want to see the field "NameDepartament" departments table with the name of the respective department of the city to put the user "admin".
 
 
I would like you please explain how I could do this
 
sorry as I wrote the English, is to use a translator because I speak Spanish
 
thank you very much in advance

 



#2 davidoster

davidoster

    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts
  • LocationAthens, Greece

Posted 01 August 2013 - 10:56 PM

Hello and welcome to the forums Roberto Fabian Rosero Diaz.

 

Can you please separate this:

"however, in the grocery crud controller, I'm standing on the table "invoices", I have two users: "admin" and "mauro" then the admin user will be entering fields in the table "invoices", including the "NameCity "that I bring to the table" cities ", I want the user" mauro "can see the records that I put the admin user, but this Signature: User, rather than viewing the" NameCity "I want to see the field "NameDepartament" departments table with the name of the respective department of the city to put the user "admin"."

 

to simple questions one by one because like this we can't understand exactly what you need to do. Just right it like this,

1. I want the mauro user to see this

2. I want the admin user to do that

3. ...

 

thank you.


____________________________________________________________

 

rtfm_small.jpg---!!!Please read these guidelines before asking to the forums!!!---

____________________________________________________________

 

David Oster aka George Pasparakis,
http://odphotography.com
http://eletter.gr


#3 Roberto Fabian Rosero Diaz

Roberto Fabian Rosero Diaz

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 02 August 2013 - 01:17 PM

1. I want the user "admin" enter records with the "NameCity" and not by "NameDepartament".
 
2. and I want the user "mauro" see the records by "NameDepartament" and not by "NameCity" meaning that records the "NameDepartament" you see here are relevant to cities that income the user "admin".
 
 
por favor de nuevo perdonen el ingles, uso un traductor por que no lo se hablar

 

 

 



#4 davidoster

davidoster

    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts
  • LocationAthens, Greece

Posted 05 August 2013 - 11:59 AM

1. $crud->set_relation('id_city', 'city','NameCity');

2. $crud->where...


____________________________________________________________

 

rtfm_small.jpg---!!!Please read these guidelines before asking to the forums!!!---

____________________________________________________________

 

David Oster aka George Pasparakis,
http://odphotography.com
http://eletter.gr


#5 Roberto Fabian Rosero Diaz

Roberto Fabian Rosero Diaz

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 05 August 2013 - 09:11 PM

good afternoon davidoster, thanks for your reply, but the problem is as follows:
 
the way you put it, the user "fabian" if you let him enter records with the "NameCity", but the user "mauro" not "NameDepartament", the field appear empty
 

as make I do that the user "mauro" will display "NameDepartament" corresponding to "NameCity" I enter the user "fabian", that's what I want to know

 

from already thank you very much
 
again sorry for the English, I'm using the google translator


#6 davidoster

davidoster

    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts
  • LocationAthens, Greece

Posted 05 August 2013 - 10:40 PM

Sorry I am confused! I can't understand what you need to do.


____________________________________________________________

 

rtfm_small.jpg---!!!Please read these guidelines before asking to the forums!!!---

____________________________________________________________

 

David Oster aka George Pasparakis,
http://odphotography.com
http://eletter.gr


#7 Roberto Fabian Rosero Diaz

Roberto Fabian Rosero Diaz

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 06 August 2013 - 01:16 PM

davidoster hello thanks for following this topic.
 
I'll post an example of what I want:
 
in the table "city" I have the following record:
 
id: 001 (pk)
NameCity: Cali
id_dpto: 33 (table fk departments)
 
in the table "departments" I have this other record:
 
id: 33 (pk, which is related to the table "city")
NameDepartament: Valle del Cauca
 
 
then the user "fabian" enters the table "invoices" track, including the "NameCity" field, that would be the city "Cali", but the user "mauro" will never look at the "NameCity" field but vera the "NameDepartament" corresponding field, that is, instead of looking in the "Cali", which will see is "Valle del Cauca", since it corresponds to the city "Cali".
 
that's what I want to know
 
friend please help me with this as it is the only thing I needed to finish my project, and depend only on your answers to finish, and I can not find anything on google that I may have
 
sorry again for the bad translation
 
from already thank you very much


#8 davidoster

davidoster

    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts
  • LocationAthens, Greece

Posted 07 August 2013 - 04:47 AM

I still believe that the answer on http://www.grocerycr...view/#entry8792

is the answer to your problem. I can't help you any more. This is not a Grocery CRUD problem, this is a logical(programming) problem that you need to solve yourself.

Sorry.


____________________________________________________________

 

rtfm_small.jpg---!!!Please read these guidelines before asking to the forums!!!---

____________________________________________________________

 

David Oster aka George Pasparakis,
http://odphotography.com
http://eletter.gr


#9 Roberto Fabian Rosero Diaz

Roberto Fabian Rosero Diaz

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 08 August 2013 - 01:23 PM

davidoster, thanks for replying, I am aware that my problem is the same thing you're saying, but the reason that I put it is that, I've tried everything to solve this problem, (relationship one by one, which is what you're putting up, relationship of one to many, many to many relationship) and none works, I tried to combine them, well, a myriad of things and nothing has worked, I think I came to the conclusion that what this problem is not be performed in grocery crud
 
 
anyway, thank you very much for your help davidoster.






Also tagged with one or more of these keywords: field, user, table

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users