This topic is locked

Define a Session Variable

8/22/2008 7:39:29 AM
PHPRunner General questions
T
tlalle author

At a successful login, I need to use the data in the field MerchantID. In the login page I have defined Account & Password as the fields to verify credentials. Below is my table.
SELECT

ServiceID,

MerchantID,

ServiceType,

Status,

Account,

Password,

BusinessName,

DBA

FROM dbo.Travel
what is the syntax for capturing the data in the field "MerchantID". After reading a through the forum... it appears I should be setting a SESSION variable.
thanks you in advance.

J
Jane 8/22/2008

Hi,
to select MerchantID value use following code in theAfterSuccessfulLogin event on the Eventstab:

global $conn;

$str = "select MerchantID from TableName where Account='".$_SESSION["UserID"]."'";

$rs = db_query($str,$conn);

$data = db_fetch_array($rs);
$MerchantID = $data["MerchantID"];

T
tlalle author 9/8/2008

I am getting a differnet error after adding your code:
[indent]Microsoft VBScript compilation error '800a0408'
Invalid character
/travel/include/events.asp, line 12
global $conn;

-------^
[/indent]

events.asp page
*<%

// After successful login

Sub AfterSuccessfulLogin(username,password)

'** Redirect to another page ****

global $conn;

$str = "select MerchantID from TableName where Account='".$_SESSION["UserID"]."'";

$rs = db_query($str,$conn);

$data = db_fetch_array($rs);
$MerchantID = $data["MerchantID"];
Response.Redirect "http://www.mydomain.com/nexres/search/power_search.cgi?&src=10021365&src_aid="; & $MerchantID

End Sub ' AfterSuccessfulLogin
%>*

J
Jane 9/8/2008

Hi.
this code is for PHPRunner.

Please re-post your topic on the ASPRunnerPro forum.