I need to put into table column with user, to see who create record and thanks to this user can see only "his" cases. As for me php, sql and rest is something new so I ask.
can you help me how to put into field/object administrator details of user who create it?
Welcome to the nuBuilder forums!
Please register and login to view forums and other content only available to registered users.
Please register and login to view forums and other content only available to registered users.
How to put current user into table (to see who create record
-
- Posts: 6
- Joined: Mon Dec 21, 2015 1:43 pm
-
- Site Admin
- Posts: 2791
- Joined: Mon Jun 15, 2009 2:23 am
- nuBuilder Version: 4.5
- Been thanked: 4 times
Re: How to put current user into table (to see who create re
maw2be,
Adding certain fields to a table will automatically record user information.. http://wiki.nubuilder.net/nubuilderv3/i ... ave_Button
Steven
Adding certain fields to a table will automatically record user information.. http://wiki.nubuilder.net/nubuilderv3/i ... ave_Button
Steven
-
- Posts: 6
- Joined: Mon Dec 21, 2015 1:43 pm
Re: How to put current user into table (to see who create re
thanks
but i need to see who create "row" so I create table USER and compare USER to #nu_user_name#
but i need to see who create "row" so I create table USER and compare USER to #nu_user_name#
-
- Site Admin
- Posts: 2791
- Joined: Mon Jun 15, 2009 2:23 am
- nuBuilder Version: 4.5
- Been thanked: 4 times
Re: How to put current user into table (to see who create re
maw2be,
You could try something like this.
And put it here..
Steven
You could try something like this.
Code: Select all
$s = "
UPDATE toy
SET toy_user_id = '#nu_user_name#'
WHERE toy_user_id = ''
";
nuRunQuery($s);
Steven
-
- Posts: 6
- Joined: Mon Dec 21, 2015 1:43 pm
Re: How to put current user into table (to see who create re
Thanks
Can you expand this littlebit?
I thinking about make additional column "modified by" where I will see who and when last time save this. can you help? With insert into SQL should be ok, problem is with searching last position so i can see who was last one.
Can you expand this littlebit?
I thinking about make additional column "modified by" where I will see who and when last time save this. can you help? With insert into SQL should be ok, problem is with searching last position so i can see who was last one.
admin wrote:maw2be,
You could try something like this.
And put it here..Code: Select all
$s = " UPDATE toy SET toy_user_id = '#nu_user_name#' WHERE toy_user_id = '' "; nuRunQuery($s);
Steven
-
- Posts: 41
- Joined: Mon Jan 18, 2016 3:01 pm
Re: How to put current user into table (to see who create re
Dear maw2be,
let's support each other, as mentioned previously by Steven, the Save Button fulfills your demand of logging who last modified the data set.
You need to add the following to your table:
Replace ?? with the name of your table.
Source: http://wiki.nubuilder.net/nubuilderv3/i ... ave_Button
It automaticly adds the zzzsys_user_id from the zzzsys_user table to the ??_log_xyz_by fields above, and works very fine for me. Than you need to make an inner join to the zzzsys_user table to get the real names.
I'm still struggling with the inner join. Help very much appreciated.
You'll find my post to this topic here: http://forums.nubuilder.cloud/viewtopic.php?f=13&t=8866
Greetings,
Timo
let's support each other, as mentioned previously by Steven, the Save Button fulfills your demand of logging who last modified the data set.
You need to add the following to your table:
Code: Select all
ALTER TABLE ??
ADD ??_log_added_at DATETIME NOT NULL,
ADD ??_log_added_by VARCHAR(25) NOT NULL,
ADD ??_log_changed_at DATETIME NOT NULL,
ADD ??_log_changed_by VARCHAR(25) NOT NULL,
ADD ??_log_viewed_at DATETIME NOT NULL,
ADD ??_log_viewed_by VARCHAR(25) NOT NULL
Source: http://wiki.nubuilder.net/nubuilderv3/i ... ave_Button
It automaticly adds the zzzsys_user_id from the zzzsys_user table to the ??_log_xyz_by fields above, and works very fine for me. Than you need to make an inner join to the zzzsys_user table to get the real names.
I'm still struggling with the inner join. Help very much appreciated.
You'll find my post to this topic here: http://forums.nubuilder.cloud/viewtopic.php?f=13&t=8866
Greetings,
Timo
-
- Site Admin
- Posts: 2791
- Joined: Mon Jun 15, 2009 2:23 am
- nuBuilder Version: 4.5
- Been thanked: 4 times
Re: How to put current user into table (to see who create re
maw2be,
Timo's answer is the better way to do it.
Steven
Timo's answer is the better way to do it.
Steven
-
- Posts: 11
- Joined: Wed Jan 17, 2018 7:06 pm
Re: How to put current user into table (to see who create re
Hi,
I tried to follow the instruction however the system does not automatically fill the information:
Any ideas why it does not work
I tried to follow the instruction however the system does not automatically fill the information:
Any ideas why it does not work
-
- Posts: 11
- Joined: Wed Jan 17, 2018 7:06 pm
Re: How to put current user into table (to see who create re
never mind changed in version 4 http://forums.nubuilder.cloud/viewtopic.php?f=19&t=9189