⚠ 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

URL Parameter "ID" passing to WHERE cond.



rka

rka
  • profile picture
  • Member

Posted 22 September 2015 - 20:53 PM

Hello, I'm new to grocerycrud and it's really great!

Maybe you can help me.

 

Let's say I have 100 customers which should change their data in my database time by time (maybe once a year)

 

So I thougt I can send them a direct link which already includes the customers primary database key, something like this:

http://localhost/crud_grocerycrud/index.php/examples/reto/edit/Zf8ffuufifddifxLKJASDFUDFUS797897kdfdfkljdifuiudfo123456789

 

Ok, but after save and "return to list" - all other customers rows would be visible - thats not good.

 

So I thougt I could somehow pass this primary key id to

$crud->where('film_id','Zf8ffuufifddifxLKJASDFUDFUS797897kdfdfkljdifuiudfo123456789');

 

Or do you have a better idea?

One customer should only can see and modify his single row. He should not see other customers rows.

 

Thank you very much

Regards,

rk

 


Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 23 September 2015 - 04:54 AM

Hi

 

Well this situation is very much possible for working around. Based on the criteria that you may choose / understand whether to restrict user or not, you can set the primary key being edited into session and when u are back to list and if you find the id in session, you can add the where clause. 

This way you can restrict the user to that single ID only. 

 

But there may be implecations to the same. You have to understand as how you are going to and when you are going to reset the session id so next when u come back with other id  or specific login of admin, you still would not like to be still restricting the listing as per the id stored into session.