babymerc
Posts: 4
|
Posted: 03/10/2004, 12:27 AM |
|
Please help..
My problem is I want to display User Information based on the current session_id() in a form built by Record Builder.
I've created a table(temp) with fields Sid(for Session Id), Username(for username), Add(for Address). Then, a form using the Record Builder in CCS(with Datasource=temp).
I use this code to call the current Session Id and set the variable for Session Id.
session_start(); //starts the session
$sesid = "". session_id(); //assign the value to $sesid
print $sesid; //check to see if code is working?answer=yes
My idea is:
SELECT Username, Add FROM temp WHERE Sid = '$sesid';
...and the result will(should) be displayed in the from that i created using the Record Builder. I know the codes for this form is generated by CCS in the code section of CCS. BUT...because I'm not familiar with PHP, I do not know where to set the value of $sesid so the form will display the Information of the current session_id().
Thank You.
|
|
|
RonB
Posts: 228
|
Posted: 03/12/2004, 6:55 AM |
|
A few questions spring to mind:
- do you want this to occur without the user loging in. If yes this is not possible. Sessionid says nothing about the user. There is no correlation between the session id and the id of the user. The only way to get info from the user is to force them to login.
- if you are asking users to login ....why mess with sessionid's Just use the functions that come with CCS (CCGetUserID()) and query the database :
$db= new clsDBtemp();
$Gridname->controlname->setvalue(CCGetDBValue("SELECT concat_ws(' ', user_name,Add) userinfo FROM UserTable WHERE user_id=" .CCGetUserID() ,$db);
unset($db));
|
|
|
RonB
Posts: 228
|
Posted: 03/12/2004, 6:59 AM |
|
Should be:
$db= new clsDBtemp();
$Gridname->controlname->setvalue(CCGetDBValue("SELECT concat_ws(' ', user_name,Add) userinfo FROM UserTable WHERE user_id=" .CCGetUserID() ,$db));
unset($db);
|
|
|
|