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

 Got stuck with "only records from user"

Print topic Send  topic

Author Message
Markie


Posts: 251
Posted: 11/24/2005, 3:07 AM

:(

Dear folks,

I know many posts have been add to this forum about the next topic:
I try to make a page, which only shows the records from the user who has logged in. I read all the previous answers etc. but it still don't work ! So please excuse me for this question. I think I miss an important point.

I have made one MySQL table with information. When the users of my project enter the page I would like them to see only their own records. I have add a field to this table named userID. The records belonging to the user all have the same userID - information.

I have made a login page.

In the page, which will show the records, I have the following details in the Data Source:

SELECT
*
FROM
table_name // (name of the table with all the records)
WHERE
userID = {CCGetUserID()}


The Table Parameter is:

Field - Condition - Parameter
userID equals(=) CCGetUserID()

Now, when I log in to the page, I first have to enter the login details. After that, the page shows ALL RECORDS IN MY DATABASE !!!!

I have tried everything, but I still miss the point, please help ! What do I do wrong ?

Markie


_________________
The Netherlands, GMT+1
Tools: CCS 5.1, Windows 7, Navicat, Ultraedit
Local server: XAMPP with Apache, php and MySQL
Webserver: Windows 2008 IIS 7, php and MySQL
View profile  Send private message
wkempees
Posted: 11/24/2005, 4:40 AM

A Parameter is something past, like through URL or so.
What you want is type Expression, 'cause you are building an expression
CCGetUserId()

At least that's what I can think of right now.

Walter
wkempees
Posted: 11/24/2005, 4:52 AM

sorry typo

something pas

something passed
Gena

Posts: 591
Posted: 11/24/2005, 5:04 AM

Quote Markie:
I have made a login page.

In the page, which will show the records, I have the following details in the Data Source:

SELECT
*
FROM
table_name // (name of the table with all the records)
WHERE
userID = {CCGetUserID()}


The Table Parameter is:

Field - Condition - Parameter
userID equals(=) CCGetUserID()


Check where you store UserID parameter - cookies, session etc. After chect if you have set "Type:" on the Table parameter properties screen right.
_________________
Gena
View profile  Send private message
Markie


Posts: 251
Posted: 11/24/2005, 5:48 AM

:-/

Thanks for your replies, but it doesn't seem to work. I really hope there is somebody out there who is willing to help me step-by-step.

I have started again from scratch.
In MySQL I have made two tables:

For your information, here are my tables:

CREATE TABLE `login` (
`id` int(11) NOT NULL auto_increment,
`naam` tinytext NOT NULL,
`login` tinytext NOT NULL,
`password` tinytext NOT NULL,
`groep` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM

and

CREATE TABLE `members` (
`id` int(11) NOT NULL auto_increment,
`naam` tinytext NOT NULL,
`hobby` tinytext NOT NULL,
`userid` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM

With CSS I have made a new, tiny project with two pages, named "members" and "login".

In the page "members" I have used the next code in Data Source:

SELECT * FROM members WHERE userid='{Expr0}'

when double clik on userid='{Expr0}' I see the code:

Field - Condition - Parameter
userid equals(=) CCGetUserID()

Field Type: text
Parameter Type: expression

In the login - page, I have add the following code to the login - button:

//Custom Code @7-2A29BDB7
// -------------------------
function Login_DoLogin_OnClick(& $sender) {

if ($Login_DoLogin_OnClick == true) {
$db = new clsDBConnection1();
CCSetSession("User_Name", CCDLookUp("User_Name","Users","User_ID=".$db->ToSQL(CCGetUserID(),ccsInteger), $db) );
$db->close();
}

}
// -------------------------
//End Custom Code

Now, when I upload the two pages with FTP to my server and login to the page members.php, I first see the login - page (that's ok). When I enter username and password, I get access to the members page.

But, now the page doesn't show any records. It says something like "no records found".

Please, help me out ! What do I do wrong ?

Markie
_________________
The Netherlands, GMT+1
Tools: CCS 5.1, Windows 7, Navicat, Ultraedit
Local server: XAMPP with Apache, php and MySQL
Webserver: Windows 2008 IIS 7, php and MySQL
View profile  Send private message
Markie


Posts: 251
Posted: 11/24/2005, 6:22 AM

Question: is there any chance I have to replace User_Name in CCSetSession and User_Name, Users and User_ID in CCDLookUp with the names of the columns in my tables ? If so, what do I have to rename ?
_________________
The Netherlands, GMT+1
Tools: CCS 5.1, Windows 7, Navicat, Ultraedit
Local server: XAMPP with Apache, php and MySQL
Webserver: Windows 2008 IIS 7, php and MySQL
View profile  Send private message
lvalverdeb

Posts: 299
Posted: 11/24/2005, 8:31 AM

I have two suggestions:

1) make the login field in the login table and the user_id in the members table equivalent e.g. if I have markie in the login field I also have markie in the userid field in the members table.

2) replace the source for {Expr0} from CCGetUserID() to CCGetUserLogin()

Luis
_________________
lvalverdeb
CR, GMT-6
XAMPP/Ubuntu/CCS3.2/4
View profile  Send private message
peterr


Posts: 5971
Posted: 11/24/2005, 11:36 AM

Markie,
Looking at your orginal post the only mistake I see is in {CCGetUserID()}. The SQL should look like this:
SELECT * FROM table_name WHERE userID = {userID}
Then your SQL parameter configuratoin will replace {userID} with CCGetUserID:
Field - Condition - Parameter
userID equals(=) CCGetUserID()
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
Markie


Posts: 251
Posted: 11/24/2005, 11:41 AM

Thank you all for your fast and high quality information. Now It works !


_________________
The Netherlands, GMT+1
Tools: CCS 5.1, Windows 7, Navicat, Ultraedit
Local server: XAMPP with Apache, php and MySQL
Webserver: Windows 2008 IIS 7, php and MySQL
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.