jim7567g
Posts: 38
|
| Posted: 01/05/2005, 6:12 PM |
|
Hello, In the following code I am able to set the session variable "score" without any problems, but in the second bit of code I am having a problem setting the session variable using the CCDLookup.
//Custom Code @2-B3150B9E
// -------------------------
global $array;
CCSetSession("score", 123456);
// -------------------------
//End Custom Code
//Custom Code @5-B3150B9E
// -------------------------
global $array;
function Login_DoLogin_OnClick() {
if ($Login_DoLogin_OnClick == true) {
$db = new clsDBConnection1();
CCSetSession("category", CCDLookUp("product_category_id","users","user_id=".CCGetUserID(), $db) );
unset($db);
}
}
// -------------------------
//End Custom Code
If I understand this correctly I am setting the session variable name to "category" and then performing a database query where "product_category_id" is the column name, "users" is the table name, and I finding the correct record using the comparison of the user_id column against the session user_id variable.
If I have this correct then my "category" session should have a number assigned to it but it continues to be blank.
Do I need to specify some other information that I may be missing?
Thanks for any help I can get.
_________________
Jim |
 |
 |
peterr
Posts: 5971
|
| Posted: 01/05/2005, 11:40 PM |
|
In such cases I always debug my code by splitting such statement into several simpler statements, then I can see exactly which part doesn't work. For example does CCSetSession("category",1) work? Does CCSetSession("category","1") work? Does CCDLookup returns any value by itself? Is $Login_DoLogin_OnClick == true really true? What is the value of UserID? Etc.
Probably only you can answer such questions and quickly find the problem
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
JIm
|
| Posted: 01/06/2005, 2:58 AM |
|
That points me in the right direction.
Thank you. It's probably syntax again.
|
|
|
 |
DonB
|
| Posted: 01/06/2005, 4:04 PM |
|
You don't really have a column names "product_category_id" in the "users"
table, do you?
--
DonB
http://www.gotodon.com/ccbth
"jim7567g" <jim7567g@forum.codecharge> wrote in message
news:541dc9e7d057f2@news.codecharge.com...
> Hello, In the following code I am able to set the session variable
"score"
> without any problems, but in the second bit of code I am having a problem
> setting the session variable using the CCDLookup.
>
> //Custom Code @2-B3150B9E
> // -------------------------
> global $array;
> CCSetSession("score", 123456);
> // -------------------------
> //End Custom Code
>
> //Custom Code @5-B3150B9E
> // -------------------------
> global $array;
> function Login_DoLogin_OnClick() {
>
> if ($Login_DoLogin_OnClick == true) {
> $db = new clsDBConnection1();
> CCSetSession("category",
> CCDLookUp("product_category_id","users","user_id=".CCGetUserID(), $db) );
> unset($db);
> }
>
> }
> // -------------------------
> //End Custom Code
>
> If I understand this correctly I am setting the session variable name to
> "category" and then performing a database query where
"product_category_id" is
> the column name, "users" is the table name, and I finding the correct
record
> using the comparison of the user_id column against the session user_id
> variable.
>
> If I have this correct then my "category" session should have a number
assigned
> to it but it continues to be blank.
>
> Do I need to specify some other information that I may be missing?
>
> Thanks for any help I can get.
> _________________
> Jim
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
jim7567g
Posts: 38
|
| Posted: 01/06/2005, 4:38 PM |
|
Yes I do Don. I'm new at this.. lol
My problem lies with function Login_DoLogin_OnClick()
Is this function a part of CCS or php?
_________________
Jim |
 |
 |
DonB
|
| Posted: 01/07/2005, 3:10 PM |
|
Yes, that's an event handler for the button named DoLogin.
As Peter suggested, you need to break down the code into parts and check
each one to isolate the problem. I think that you are not retrieving a
value from the database lookup, or the row it's read from has no value for
the product_category_id.
--
DonB
http://www.gotodon.com/ccbth
"jim7567g" <jim7567g@forum.codecharge> wrote in message
news:541ddd9e8d5078@news.codecharge.com...
> Yes I do Don. I'm new at this.. lol
>
> My problem lies with function Login_DoLogin_OnClick()
>
> Is this function a part of CCS or php?
> _________________
> Jim
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
jim7567g
Posts: 38
|
| Posted: 01/07/2005, 3:21 PM |
|
I'm able to set the session variable using:
> $db = new clsDBConnection1();
> CCSetSession("category",
> CCDLookUp("product_category_id","users","user_id=".CCGetUserID(), $db) );
> unset($db);
but I think I'm close to a solution.
_________________
Jim |
 |
 |
jim7567g
Posts: 38
|
| Posted: 01/09/2005, 5:53 PM |
|
My hosting service told me that all I needed to do was use the following code to set the session time:
session_cache_expire(480);
I did this and then checked to see that the time had been changed. Everything checked out ok execpt that the session still timed out in 3 mins. (server default).
Does this code need to be added in the common.php file for it to work???
_________________
Jim |
 |
 |
|