This topic is locked

Default Value

5/14/2018 5:44:33 PM
PHPRunner General questions
P
PaulM author

I have a table that I have a lookup for and want to set a default. The default value should be the Osd_shortcode that the logged in person works in. I have an office table that hold the o_shortcode and an Office_Staff table that holds the users name which is the same name as in the login table the tables are linked by OS_O_id -> O_id.
the syntax I was thinking of is something like:
select O_shortcode

from Office,

Office_Staff

where OS_name=:users.fullname

and OS_O_id=O_id
Could you please help with the correct syntax?
Thanks

DealerModulesDevClub member 5/14/2018



I have a table that I have a lookup for and want to set a default. The default value should be the Osd_shortcode that the logged in person works in. I have an office table that hold the o_shortcode and an Office_Staff table that holds the users name which is the same name as in the login table the tables are linked by OS_O_id -> O_id.
the syntax I was thinking of is something like:
select O_shortcode

from Office,

Office_Staff

where OS_name=:users.fullname

and OS_O_id=O_id
Could you please help with the correct syntax?
Thanks


Hi Paul,

Have you tried to save a session variable based on the login of the user and then use the session variable name later in your page that you are designing as the default?
Thanks

Paul

M
Mark Kramer 5/14/2018



I have a table that I have a lookup for and want to set a default. The default value should be the Osd_shortcode that the logged in person works in. I have an office table that hold the o_shortcode and an Office_Staff table that holds the users name which is the same name as in the login table the tables are linked by OS_O_id -> O_id.
the syntax I was thinking of is something like:
select O_shortcode

from Office,

Office_Staff

where OS_name=:users.fullname

and OS_O_id=O_id
Could you please help with the correct syntax?
Thanks


Here is where to start:

https://xlinesoft.com/phprunner/docs/modify_sql_query_on_the_fly.htm
Then after you read up on this you need to go to your "AfterSuccessfulLogin" event and define your $_SESSION
Like this:
$_SESSION["fullname"] = $data['fullname'];
Then go to AfterTableInit() of each page Then add a query something

Like this:
if (Security::getUserName()!="admin")
$query->addWhere("fullname like '%".$_SESSION["fullname"] ."%'");
This needs to be done on all pages.
Hope this helps. It works pretty well for me just change "fullname" to whatever you define as the $_SESSION varable

P
PaulM author 5/15/2018



Here is where to start:

https://xlinesoft.com/phprunner/docs/modify_sql_query_on_the_fly.htm
Then after you read up on this you need to go to your "AfterSuccessfulLogin" event and define your $_SESSION
Like this:
$_SESSION["fullname"] = $data['fullname'];
Then go to AfterTableInit() of each page Then add a query something

Like this:
if (Security::getUserName()!="admin")
$query->addWhere("fullname like '%".$_SESSION["fullname"] ."%'");
This needs to be done on all pages.
Hope this helps. It works pretty well for me just change "fullname" to whatever you define as the $_SESSION varable


Thanks for this, I'll give it a try