frans
|
| Posted: 06/16/2003, 4:30 AM |
|
Hello,
Is there a way to update and view only own records from logged in user.
I'm using codecharge 2.0.5. Apache, php and Mysql.
Thanks.
|
|
|
 |
rrodgers
|
| Posted: 06/16/2003, 6:12 AM |
|
You need to
1) add a UserID field to every table you what to filter by user.
2) add another where clause to every grid that uses these tables Filtering by
CCGetUserID().
3) Add a Hidden field bound to the UserID on every update page for the tables with the UserID, Set the default value to CCGetUserID().
rob
|
|
|
 |
frans
|
| Posted: 06/16/2003, 7:17 AM |
|
Hello Rob,
Is the ccgetuserid a codecharge function. I couldn't find it in the help files. I'm using Codecharge and not Codecharge Studio
Thanks
|
|
|
 |
rrodgers
|
| Posted: 06/16/2003, 8:52 AM |
|
I see that now<G>
The method would most likley be the same. You just need to find the right function to return the userid or get it directly from the session variable.
rob
|
|
|
 |
rrodgers
|
| Posted: 06/16/2003, 9:01 AM |
|
A quick look through some CC code and I don't see that it provides the function. So you will need to use the session variable that holds the userid. For ASP it would be Session("UserID"). I don't know php so someone else will need to help out a little here.
rob
|
|
|
 |
Jen
|
| Posted: 06/17/2003, 12:24 AM |
|
2) add another where clause to every grid that uses these tables Filtering by
CCGetUserID().
3) Add a Hidden field bound to the UserID on every update page for the tables with the UserID, Set the default value to CCGetUserID().
Hi Rob,
Can you explain how to do these two things? I"m having the same question. I use CodeCharge Studio.
Thanks,
Jen
|
|
|
 |
rrodgers
|
| Posted: 06/17/2003, 6:26 AM |
|
>>2) add another where clause to every grid that uses these
>>tables Filtering by CCGetUserID().
>>3) Add a Hidden field bound to the UserID on every update page
>>for the tables with the UserID, Set the default value to CCGetUserID().
>>Hi Rob,
>>Can you explain how to do these two things? I"m having the same question. I >>use CodeCharge Studio.
2) Click on your grid. Click on the Datasource property. Click on the button with "..." There is a list box there for the where clause. Click the + button.
Select your UserID field, Then Enter CCGetUserID() under parameter source. Change Parameter Source Type to Expression. The Tutorial spends a lot of time on this. If you don't remember it redo the tutorial for more info.
3)Click somewhere in your update form. Select the Hidden control from the forms toolbox. Click on your hidden field. Select your UserID field for the control source. In the Default Value property enter CCGetUserID()
That should do it.
rob
|
|
|
 |