jcode
Posts: 6
|
| Posted: 03/12/2008, 12:11 PM |
|
I have a logon page and a grid. I can't get the userid of the logon to pass into the before build select where I am trying to pass that variable into the where clause.
$customer->ds->Where.='user1 = variable name';
I have tried to use CCGetUserID function.
|
 |
 |
DonP
|
| Posted: 03/12/2008, 11:30 AM |
|
The syntax is:
$customer->ds->Where .= " user1=" . CCGetUserID();
or if you prefer a variable:
$UserID = CCGetUserID();
$customer->ds->Where .= " user1=" . $UserID;
This code expects there to already be a WHERE in the query and don't
forget the space before the first quote. Without it, it sometimes causes
problems. You can also do it in the SQL panel in CCS. Just add a WHERE
there and set CCGetUserID() as the parameter or UserID as a session
value. I don't have CCS open so this is from memory and you might need
to tweak it a bit.
Don (DonP)
jcode wrote:
> I have a logon page and a grid. I can't get the userid of the logon to pass into
> the before build select where I am trying to pass that variable into the where
> clause.
> $customer->ds->Where.='user1 = variable name';
> I have tried to use CCGetUserID function.
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>
|
|
|
 |
jcode
Posts: 6
|
| Posted: 03/13/2008, 11:46 AM |
|
Thanks for the help, but with that code I receive this error.
Database Error: Unknown column 'bob' in 'where clause'
$jcust->ds->Where.=" user1 =" .CCGetUserID();
bob was the logon userid. I am running 4.0 of CodeCharge and version 5.0 of MYSQL.
|
 |
 |
DonP
|
| Posted: 03/13/2008, 5:58 PM |
|
The user ID is generally a numeric value and should auto increment with
each new user to keep from having duplicates. If you're sure there can
be only one "bob" ever, then the query just needs quotes around the
value. I don't use v4 but the query should be the same in any version:
$jcust->ds->Where.=" user1 ='" .CCGetUserID() . "'";
Don (DonP)
jcode wrote:
> Thanks for the help, but with that code I receive this error.
> Database Error: Unknown column 'bob' in 'where clause'
>
> $jcust->ds->Where.=" user1 =" .CCGetUserID();
> bob was the logon userid. I am running 4.0 of CodeCharge and version 5.0 of
> MYSQL.
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
datadoit
|
| Posted: 03/14/2008, 10:03 AM |
|
or
$jcust->ds->Where.=" user1 =" .CCToSQL(CCGetUserID(),ccsInteger);
|
|
|
 |
jcode
Posts: 6
|
| Posted: 03/14/2008, 10:57 AM |
|
Thanks. It gets me what I need.
|
 |
 |