CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Limit Grid Results to Current User

Print topic Send  topic

Author Message
godfathr

Posts: 2
Posted: 07/13/2013, 9:07 AM

I've looked through the forums but can't find an answer that works for me.

I want to limit the results in a grid that displays user info to only the current user.

I've tried setting the default value of a label to CCGetUserID(). This didn't work.

I've tried using the CCDLookUp and assigning it to a php variable with a Before Show event for the page:

global $myID;
$myID = CCGetUserID();
$myConnection = new clsDBgodfathrweb();
$currentID = CCDLookUp("ID","user_main","ID=\"" .$userID . "\"", $myConnection);
echo $currentID;
$myConnection->close();

Still nothing... Ideas where I'm going wrong?
View profile  Send private message
saseow

Posts: 744
Posted: 07/13/2013, 12:08 PM

When you create your datasource for the grid, add a where condition by selecting the users field and making it equal to the global variable for logged in users which is defaulted to UserID. Make the type 'session' and the results will only be for the logged in user.
View profile  Send private message
jekes

Posts: 36
Posted: 07/15/2013, 1:03 AM

Follow saseow tips
Be careful to set the security options of your project, otherwise the functions CCGetUserLogin, CCGetSession("UserId") ... will not be add to the common file of your project.
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.