CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 How to get logon variable

Print topic Send  topic

Author Message
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.
View profile  Send private message
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.
View profile  Send private message
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.
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.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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