Help with session variable please - CS5.5 PHP

Hi all,
I am needing a little assistance with using a session variable and hope that someone may point me in the right direction.
I have created a PHP page that uses the Dreamweaver 'User Authentication' feature, and the basics of this works fine, directing a user to the correct pages depending on whether they are or are not a valid user. I would like however to personalise the 'valid user' page with the persons Username as entered in the User Authentication table....a seemingly simple task using a session variable, but one that I just don't seem to be able to get working!
The code generated for the UA on page 1 is as follows:
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
  session_start();
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
  $_SESSION['PrevUrl'] = $_GET['accesscheck'];
if (isset($_POST['txtfirst_name'])) {
  $loginUsername=$_POST['txtfirst_name'];
  $password=$_POST['txtsurname'];
  $MM_fldUserAuthorization = "";
  $MM_redirectLoginSuccess = "member_update.php";
  $MM_redirectLoginFailed = "login.php";
  $MM_redirecttoReferrer = false;
  mysql_select_db($database_panto, $panto);
  $LoginRS__query=sprintf("SELECT firstname, surname FROM web_access WHERE firstname=%s AND surname=%s",
    GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
  $LoginRS = mysql_query($LoginRS__query, $panto) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  if ($loginFoundUser) {
     $loginStrGroup = "";
    if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
    //declare two session variables and assign them
   $_SESSION['MM_Username'] = $loginUsername;
    $_SESSION['MM_UserGroup'] = $loginStrGroup;         
    if (isset($_SESSION['PrevUrl']) && false) {
      $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];   
    header("Location: " . $MM_redirectLoginSuccess );
  else {
    header("Location: ". $MM_redirectLoginFailed );
?>
Firstly, the text highlighted in red above appears to be setting the session variable that I require. Is This correct?
If so, what is the code that I need to place in page 2 to use that session variable? or
Do I need to do something else on page 1 to properly assign the session variable?
Would really appreciate your expertise
Mark

It looks as though you've set the columns incorrectly in the User Authentication server behavior. This is the SQL query that checks the user's credentials:
  $LoginRS__query=sprintf("SELECT firstname, surname FROM web_access WHERE firstname=%s AND surname=%s",
    GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
You're looking for firstname and surname, whereas you should be looking for the user's login name and password.
$_SESSION['MM_Username'] is a session variable that stores the user's login name. To use it in a subsequent page, all that's needed is for the page to begin with session_start(). You can then echo the value to display it.
If you want to display the person's real name, you need to create a recordset in the second page using $_SESSION['MM_Username'] to find the firstname and surname. Alternatively, you can edit the existing code like this (I've copied only part of it):
  $LoginRS__query=sprintf("SELECT firstname, surname FROM web_access WHERE firstname=%s AND password=%s",
    GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
  $LoginRS = mysql_query($LoginRS__query, $panto) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  if ($loginFoundUser) {
     $loginStrGroup = "";
    $row = mysql_fetch_assoc($LoginRS);
     $_SESSION['full_name'] = $row['firstname'] . ' ' . $row['surname'];
    if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
    //declare two session variables and assign them
   $_SESSION['MM_Username'] = $loginUsername;
    $_SESSION['MM_UserGroup'] = $loginStrGroup;
You can then use $_SESSION['full_name'] in a subsequent page that begins with session_start().

Similar Messages

  • A little bit of help with Bind variables please

    Hi,
    I am having a bit of trouble with bind variables I have been looking at the Dev guide and the forum to try and achieve this and it is still not happening for me, could anybody please help or point me in the right direction:
    I have created a simple PersonVO with the basic query:
    Select distinct full_name from xxml_people where person_id = :1
    In the PersonVOImpl.java I have added the method:
    public void initQuery(String personId)
    Number person = null;
    try
    person = new Number(personId);
    catch
    (Exception e){}
    setWhereClauseParam(1,person);
    executeQuery();
    Then in the PersonAM I have added the method:
    public void initPersonQuery(String personId)
    getPersonVO1().initQuery(personId);
    I then call this method in my processRequest section of my page controller:
    PersonAMImpl am = (PersonAMImpl) pageContext.getRootApplicationModule();
    String personId = "581";
    am.initPersonQuery(personId);
    When I try and run this I get the error:
    oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement: SELECT distinct full_name from xxml_absence_calendar where person_id = :1
    java.sql.SQLException: ORA-01006: bind variable does not exist
    Am I binding the variables correctly? Or am I making some stupid mistake?
    I am ultimately looking to create a messageChoice where the logged in user will see a list of all organisations underneath him and the one level above. I plan to do this by passing the User’s Organisation name into a VO query using the organisation as a Bind Variable. I think once I have worked out how to bind variables this should be straight forward.
    Many Thanks

    Even though the parameter binding values may be same, you should never use the positional param more than once. So always go for the format
    select distinct full_name from xxml_people where supervisor_id = :1
    UNION
    select distinct full_name from xxml_people where person_id = :2
    --Shiv                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Help with CLASSPATH variable please

    Hi everyone!!
    Please, help to set up my classpath variable. I know I know I have guidelines in API but I don't achieve it, I'm so clumsy.
    I've formated my hard disk and installed everything again, but the classpath is wrong because I can't compile my java files.
    I've tried with this:
    C:\Program Files\Java\jdk1.5.0_06\scr.zip;C:\Program Files\Java\jdk1.5.0_06\javac.exe;C:\Program Files\Java\jdk1.5.0_06\java.exe
    I've also tried with the same lines but unnaming files (finishing with '\')
    What am I doing wrong?
    Thank you very much for your attention and help.
    Merry Christmas and Happy New Year!!
    And I hope the Three Wise Men bring you everything!!

    Please post your exact problem and the exact error message. I think you are having a problem compiling, but I am not sure. What is not working? What is the error?
    You posted a path, but if that is your Classpath, you should not have javac or java in the Classpath.

  • Need help with Patch Tool in CS5

    I am having a problem using the patch tool in Photoshop CS5. I click on the Patch Tool and select the Source option from the upper tool bar. Then I circle a gray area in the background of my photo and, holding down the left mouse button, I drag the selection to a black area in the background and release the mouse button. Instead of turning the selected area black it just makes the area slightly darker than it was originally. I just don’t understand why I can’t use the patch tool and any help would be appreciated.

    Thank you very much for these suggestions. Robert
    Noel Carboni <[email protected]> wrote:
    Noel Carboni http://forums.adobe.com/people/Noel+Carboni created the discussion
    "Re: Need help with Patch Tool in CS5"
    To view the discussion, visit: http://forums.adobe.com/message/4308270#4308270

  • Help with access control please

    So I'm trying to set up my brother's PSP to the wirless network through MAC address timed access. What I want to do is make it so that he can only access it through certain times in the day. I'm having troubles with actually getting it to work. Everytime I set it up, the PSP only show's up as a DHCP client and not a Wireless client. I tried the option panel with the add wireless clients through the first try access. Could I get some help with this issue please? Thanks!

    Just to calm your fears... There is no conspiracy. If someone had an answer or a suggestion they would post it.

  • Help with Report Variables

    I have been doing battle with the SBO Customer Receivables Aging Report. I am trying to add the fields "Customer Reference" and "Creation Date" to the Repetitive area of the report with no success. All of the existing fields are variables, and the on-line help says to contact SAP support (which would be me) for help with changing variables. Does anyne have a list of these variables, or know how to define them?
    Many thanks,
    Mike.

    Hi Mike Stroud, i'm actualy also working on the customer ageing report. You also responded to my post. It was the reports one. Well, im not sure about the variables but i simply wrote a query that brings all that info and more up. But i'm having problems diplsying it. In the normal SAP report/print layout, if i  make the report based on the query it doesn't let me move the info from the repetitive area to the header....why.....can you get around this??? I then did it in the advanced layout but the first page is always wrong. What do you want to do with the variables?? what are you trying to achieve with the report because me and my coleagues have had a BIG problem with the ageing.

  • Please help with Load Variables / ASP

    Hello,
    I am using Load Variables to retreive a variable from an ASP
    page, (which uses a response.write) to output the variable
    getfile.onRelease = function()
    myData = new LoadVars();
    myData.onLoad = function(success){
    if(success) {
    getfile_txt.text = this.strString;
    } else {
    getfile_txt.text = "error";
    myData.load("sendFile.asp");
    stop();
    the problem is that the output says "undefined", but when I
    access the .asp page through my web browser I get the expected
    result of the variable which is "Test1.Doc"
    if any1 can help with this, i would be massivley thankful,
    thanks.

    p.s strString is the variable that I am trying to pass from
    the ASP page.

  • Need help with maintaining variable choices in new session

    I have a flash app. set up with several variables. Is there a
    simple action script that will allow the user to maintain their
    choices after closing the .swf and re-launching it?
    Thanks in advance for your help.

    how are you checking if those components have been checked or
    ticked. actually, i probably don't want to know that.
    you really should be using a listener to detect when your
    components have changed and then you can use the changed method to
    set your variables and update your sharedobject.

  • Help with web form script. PHP, CGI, Perl???

    anyone willing to help with a web form script? I have a form built, but cant seem to figure out the scripting! Should I be using Perl, CGI, PHP... What do I need to enable? I am a complete novice when it comes to scripts. Looking for a little friendly help.

    Here is a simple bit of PHP to stick in the page your form posts to. You would need to edit the first three variables to your liking, and add the html you want to serve afterwards:
    <pre>
    <?php
    $emailFrom = '[email protected]';
    $emailTo = '[email protected]';
    $emailSubject = 'Subject';
    $date = date('l, \t\h\e dS \o\f F, Y \a\t g:i A');
    $browser = $HTTPSERVER_VARS['HTTP_USERAGENT'];
    $hostname = $HTTPSERVER_VARS['REMOTEADDR'];
    $message = "$date\n\nAddress: $hostname\nBrowser: $browser\n\n";
    foreach ($_POST as $key => $value) {
    $message .= $key . ": " . $value . "\n";
    $mailResult = mail($emailTo,$emailSubject,$message,"From: $emailFrom");
    ?>
    </pre>
    This script will grab the server's date and the submitter's address and browser type. It will then list the name and value of each form field you have put on your form.
    Also, this script expects your form method="post".
    Lastly, you can offer alternate text later on in your html page based on the success of the above script with a snippet like this:
    <pre><?php
    if ($mailResult) {
    echo "Your comments have been received thank you.";
    } else {
    echo "There was an error. Please try again or contact us using an alternate method.";
    ?></pre>

  • Purchased ColdFusion 10: Having problem with session variables

    My Dept. has just bought CF10 and I'm finally updating my existing web app to CF10 from CF8. My First Problem with CF10 is using session variables.
    When using the lower version of CF (since CF 4 to 8) I have never had any problem setting up session variables and getting or using these variables in other pages after a successful login but with CF 10 it seems setting session variables and using them in other pages are a major problems. I'm not sure where have I done wrong in the codes.
    First I'm setting the session in my Application.cfc This way:
    <cfcomponent displayname="Application" output="true">
      <cfset THIS.Name ="MyNewApp"/>
      <cfset THIS.ApplicationTimeout = CreateTimeSpan(0,0,20,0) />
      <cfset THIS.SessionManagement ="YES"/>
      <cfset THIS.SessionTimeout = CreateTimeSpan( 0, 0, 20, 0 ) />
      <cfset THIS.SetClientCookies = false />
    <cffunction name="OnApplicationStart" access="public" returntype="boolean" output="false">
    <cfset application.Main_DSN = "TESTDB">
    <cfreturn true />
    </cffunction>
    <cffunction name="onApplicationEnd" output="false">
          <cfargument name="applicationScope" required="true">
        </cffunction>
    <cffunction name="OnSessionStart" access="public" returntype="void" output="false" hint="Fires when user session initializes.">
    <cfset session.loggedin = "NO">
    <cfset session.username = "">
    <cfset session.userrights = "">
    <cfset session.usergroup = "">
    </cffunction>
    </cfcomponent>
    After login, user is validated and set values to those session.variables:
    ........user validation codes here......................
    <cfif mylogin NEQ true>
          <cflocation url="/login/login.cfm">
          <cfabort
    <cfelse>
          <cfset session.loggedin="Yes">
          <cfset session.username="#Trim(Form.username)#">
         <CFSET qUserRights = LoginObj.getUserRights('#Trim(Form.username)#')>
         <cfset session.userrights = qUserRights><!--- it's a query --->
        <CFSET qUserGroup = LoginObj.getUserGroup('#Trim(Form.username)#')>
            <cfloop query="qUserGroup">
               <cfset session.usergroup = user_group>
               <cfbreak>
            </cfloop>
        <!--- ****************** ???????????????????????????????????????????????????????????????????????????
        When I do cfdump in at this level, I can see that all of these session variables have been assigned to their values.
        But these session variables are not accessible from other pages. Other pages still show these session variable without its value.
        So, when I use these cfdumps in the index.cfm it is shown as they're not yet assigned with any values   ****************** --->
       <cfdump var="#session.loggedin#">
       <cfdump var="#session.username#">
       <cfdump var="#session.userright#">
       <cfdump var="#session.usergroup#">
    </cfif>
    In index.cfm, Before Login I got:
    session.loggedin = NO
    session.username = ["empty string"]
    session.userrights = ["empty string"]
    session.usergroup = ["empty string"]
    After a successful Login:
    session.loggedin = NO
    session.username = ["empty string"]
    session.userrights = ["empty string"]
    session.usergroup = ["empty string"]
    Have I done something wrong? These codes work on CF8. Please help.
    I need to mentioned:
    CF10 is in Linux and my web app is under https not http. But these session variables should be shared bentween http and https because some older application are still in http.

    On which page is the following code?
    After login, user is validated and set values to those session.variables:
    ........user validation codes here......................
    <cfif mylogin NEQ true>
          <cflocation url="/login/login.cfm">
          <cfabort
    <cfelse>
          <cfset session.loggedin="Yes">
          <cfset session.username="#Trim(Form.username)#">
         <CFSET qUserRights = LoginObj.getUserRights('#Trim(Form.username)#')>
         <cfset session.userrights = qUserRights><!--- it's a query --->
        <CFSET qUserGroup = LoginObj.getUserGroup('#Trim(Form.username)#')>
            <cfloop query="qUserGroup">
               <cfset session.usergroup = user_group>
               <cfbreak>
            </cfloop>
        <!--- ****************** ???????????????????????????????????????????????????????????????????????????
        When I do cfdump in at this level, I can see that all of these session variables have been assigned to their values.
        But these session variables are not accessible from other pages. Other pages still show these session variable without its value.
        So, when I use these cfdumps in the index.cfm it is shown as they're not yet assigned with any values   ****************** --->
       <cfdump var="#session.loggedin#">
       <cfdump var="#session.username#">
       <cfdump var="#session.userright#">
       <cfdump var="#session.usergroup#">
    </cfif>

  • Need help with session sharing in WebCenter Portal

    Hi, How can I share session between a WebCenter Portal application and the portlets it is consuming?
    Basically I want this for authentication. In the portal framework application, I'm setting a user object in the session, How can I get the object in a portlet?
    Regards,
    Navaneet

    IN the second page, you have to make sure that the session
    has been started.
    Put this at the very top of the page -
    <?php if (!isset($_SESSION)) session_start(); ?>
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "Alidad" <[email protected]> wrote in
    message
    news:g184i4$jgf$[email protected]..
    > have created a login page (php/mysql) with username and
    password boxes.
    > when
    > the form is submitted the mainpage loads up.
    >
    > i want the main page to be specific to that user, so i
    want their name to
    > appear in the first line. eg.. Welcome back 'David'
    >
    > I read a tutorial in the past that tought me to send the
    users id in the
    > URL
    > and then create a record set on the mainpage that was
    filtered by the URL
    > parameter.
    >
    > I have forgotten how to do this and the tutorial is no
    longer available on
    > Adobe's site.
    >
    > I tried that with
    > $_SESSION['MM_Username'] = $loginUsername; \\ in first
    page then
    > echo $_SESSION["MM_username"]; \\in second page, but
    > the
    > problem is that is not showing user name.
    >
    > i need help with that please!
    >
    > can anyone tell me how to do this? Thanks in advance,
    >
    > AM
    >

  • Need help with session using dreamweaver

    have created a login page (php/mysql) with username and
    password boxes. when the form is submitted the mainpage loads up.
    i want the main page to be specific to that user, so i want
    their name to appear in the first line. eg.. Welcome back 'David'
    I read a tutorial in the past that tought me to send the
    users id in the URL and then create a record set on the mainpage
    that was filtered by the URL parameter.
    I have forgotten how to do this and the tutorial is no longer
    available on Adobe's site.
    I tried that with
    $_SESSION['MM_Username'] = $loginUsername; \\ in first page
    then
    echo $_SESSION["MM_username"]; \\in second page, but the
    problem is that is not showing user name.
    i need help with that please!
    can anyone tell me how to do this? Thanks in advance,
    AM

    IN the second page, you have to make sure that the session
    has been started.
    Put this at the very top of the page -
    <?php if (!isset($_SESSION)) session_start(); ?>
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "Alidad" <[email protected]> wrote in
    message
    news:g184i4$jgf$[email protected]..
    > have created a login page (php/mysql) with username and
    password boxes.
    > when
    > the form is submitted the mainpage loads up.
    >
    > i want the main page to be specific to that user, so i
    want their name to
    > appear in the first line. eg.. Welcome back 'David'
    >
    > I read a tutorial in the past that tought me to send the
    users id in the
    > URL
    > and then create a record set on the mainpage that was
    filtered by the URL
    > parameter.
    >
    > I have forgotten how to do this and the tutorial is no
    longer available on
    > Adobe's site.
    >
    > I tried that with
    > $_SESSION['MM_Username'] = $loginUsername; \\ in first
    page then
    > echo $_SESSION["MM_username"]; \\in second page, but
    > the
    > problem is that is not showing user name.
    >
    > i need help with that please!
    >
    > can anyone tell me how to do this? Thanks in advance,
    >
    > AM
    >

  • Row level security with session variables, not a best practice?

    Hello,
    We are about to implement row level security in our BI project using OBIEE, and the solution we found most convenient for our requirement was to use session variables with initalization blocks.
    The problem is that this method is listed as a "non best practice" in the Oracle documentation.
    Alternative Security Administration Options - 11g Release 1 (11.1.1)
    (This appendix describes alternative security administration options included for backward compatibility with upgraded systems and are not considered a best practice.)
    Managing Session Variables
    System session variables obtain their values from initialization blocks and are used to authenticate Oracle Business Intelligence users against external sources such as LDAP servers or database tables. Every active BI Server session generates session variables and initializes them. Each session variable instance can be initialized to a different value. For more information about how session variable and initialization blocks are used by Oracle Business Intelligence, see "Using Variables in the Oracle BI Repository" in Oracle Fusion Middleware Metadata Repository Builder's Guide for Oracle Business Intelligence Enterprise Edition.
    How confusing... what is the best practice then?
    Thank you for your help.
    Joao Moreira

    authenticating / authorizing part is take care by weblogic and then USER variable initialized and you may use it for any initblocks for security.
    Init block for authenticating / authorizing and session variables are different, i guess you are mixing both.

  • Problem with Session variable initialization block

    Hi,
    I'm getting strange results when using session variables in my repository files.
    I have created session variables as specified in the document which is available at
    http://www.oracle.com/technology/obe/obe_bi/bi_ee_1013/bi_admin/biadmin.html
    The main problem getting with the system session variable (USER) in the select statement.
    My select statement is as follows,
    select ':USER',case when upper(':USER') = 'KUMAR' then 'APR-05' end from Dual
    The problem is while logging into the BI Answers it is allowing all the invalid users to login who does not exist.
    when i remove the quotes and simply use :USER in the select statement it is not allowing the invalid users to login but giving error while displaying the results.
    when i remove the user variable from select statement its giving correct results.
    Can i know what is causing the problem.
    Thanks,
    Kumar.

    Hi DK,
    Check out my post Rowlevel Security?? and see if it helps you.
    Cheers!
    -Joe

  • Filtering a Recordset with session variable

    Hi
    I am trying to filter a recordset based on a session
    variable. The session variable is passed from the login page via a
    username which is their email address. This has been successful.
    However when I want to filter the users table - tbl_users to
    show their first name it doesn't work.
    I followed the adobe help tutorial plus ahave tried other
    combinations and I am now at a loss on where exactly I am going
    wrong.
    The recordset is rs_UserAccess
    I have a session variable called - MM_Username
    The table has 5 records of various users
    The code that I have fiddling with is -
    <%
    Dim rs_UserAccess
    Dim rs_UserAccess_numRows
    Set rs_UserAccess = Server.CreateObject("ADODB.Recordset")
    rs_UserAccess.ActiveConnection = MM_conn_sidecounter_STRING
    rs_UserAccess.Source = "SELECT * FROM tbl_users WHERE
    username = MM_Username"
    rs_UserAccess.CursorType = 0
    rs_UserAccess.CursorLocation = 2
    rs_UserAccess.LockType = 1
    rs_UserAccess.Open()
    rs_UserAccess_numRows = 0
    %>
    Any help would be appreciated. I have outlined below the
    different combinations I have tested.
    Try No1
    rs_UserAccess.Source ="SELECT * FROM tbl_users WHERE username
    = Session("MM_Username")”
    Message:
    Microsoft VBScript compilation error '800a0401'
    Expected end of statement
    /main.asp, line 182
    Try No2
    rs_UserAccess.Source ="SELECT * FROM tbl_users WHERE username
    = Session(‘MM_Username’)”
    Message:
    Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
    [Microsoft][ODBC Microsoft Access Driver] Undefined function
    'Session' in expression.
    /main.asp, line 186
    Try No3
    rs_UserAccess.Source ="SELECT * FROM tbl_users WHERE username
    = Session(MM_Username)”
    Message:
    Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
    [Microsoft][ODBC Microsoft Access Driver] Undefined function
    'Session' in expression.
    /main.asp, line 186
    Try No4
    rs_UserAccess.Source ="SELECT * FROM tbl_users WHERE username
    = Session Variable MM_Username"
    Message:
    Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
    [Microsoft][ODBC Microsoft Access Driver] Syntax error
    (missing operator) in query expression 'username = Session Variable
    MM_Username'.
    /main.asp, line 186
    Try No5
    rs_UserAccess.Source ="SELECT * FROM tbl_users WHERE username
    = MM_Username"
    Message:
    Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
    [Microsoft][ODBC Microsoft Access Driver] Too few parameters.
    Expected 1.
    /main.asp, line 186
    Thanks in advance
    Cheers
    Downsy

    Try this:
    rs_UserAccess.Source = "SELECT * FROM tbl_users WHERE
    username = " & Session("MM_Username")
    Keep that on one line.
    Ken Ford
    Adobe Community Expert
    Fordwebs, LLC
    http://www.fordwebs.com
    "Downsy42" <[email protected]> wrote in
    message news:[email protected]...
    > Hi
    > I am trying to filter a recordset based on a session
    variable. The session
    > variable is passed from the login page via a username
    which is their email
    > address. This has been successful.
    > However when I want to filter the users table -
    tbl_users to show their first
    > name it doesn't work.
    > I followed the adobe help tutorial plus ahave tried
    other combinations and I
    > am now at a loss on where exactly I am going wrong.
    > The recordset is rs_UserAccess
    > I have a session variable called - MM_Username
    > The table has 5 records of various users
    >
    > The code that I have fiddling with is -
    >
    > <%
    > Dim rs_UserAccess
    > Dim rs_UserAccess_numRows
    >
    > Set rs_UserAccess =
    Server.CreateObject("ADODB.Recordset")
    > rs_UserAccess.ActiveConnection =
    MM_conn_sidecounter_STRING
    > rs_UserAccess.Source = "SELECT * FROM tbl_users WHERE
    username = MM_Username"
    > rs_UserAccess.CursorType = 0
    > rs_UserAccess.CursorLocation = 2
    > rs_UserAccess.LockType = 1
    > rs_UserAccess.Open()
    >
    > rs_UserAccess_numRows = 0
    > %>
    >
    >
    >
    > Any help would be appreciated. I have outlined below the
    different
    > combinations I have tested.
    >
    >
    > Try No1
    > rs_UserAccess.Source ="SELECT * FROM tbl_users WHERE
    username =
    > Session("MM_Username")?
    > Message:
    > Microsoft VBScript compilation error '800a0401'
    > Expected end of statement
    > /main.asp, line 182
    >
    > Try No2
    > rs_UserAccess.Source ="SELECT * FROM tbl_users WHERE
    username =
    > Session(?MM_Username?)?
    > Message:
    > Microsoft OLE DB Provider for ODBC Drivers error
    '80040e14'
    > [Microsoft][ODBC Microsoft Access Driver] Undefined
    function 'Session' in
    > expression.
    > /main.asp, line 186
    >
    > Try No3
    > rs_UserAccess.Source ="SELECT * FROM tbl_users WHERE
    username =
    > Session(MM_Username)?
    > Message:
    > Microsoft OLE DB Provider for ODBC Drivers error
    '80040e14'
    > [Microsoft][ODBC Microsoft Access Driver] Undefined
    function 'Session' in
    > expression.
    > /main.asp, line 186
    >
    > Try No4
    > rs_UserAccess.Source ="SELECT * FROM tbl_users WHERE
    username = Session
    > Variable MM_Username"
    > Message:
    > Microsoft OLE DB Provider for ODBC Drivers error
    '80040e14'
    > [Microsoft][ODBC Microsoft Access Driver] Syntax error
    (missing operator) in
    > query expression 'username = Session Variable
    MM_Username'.
    > /main.asp, line 186
    >
    > Try No5
    > rs_UserAccess.Source ="SELECT * FROM tbl_users WHERE
    username = MM_Username"
    > Message:
    > Microsoft OLE DB Provider for ODBC Drivers error
    '80040e10'
    > [Microsoft][ODBC Microsoft Access Driver] Too few
    parameters. Expected 1.
    > /main.asp, line 186
    >
    > Thanks in advance
    > Cheers
    > Downsy
    >
    >
    >

Maybe you are looking for

  • How can I copy or print all text highlights in Adobe Reader for Android?

    I read many tech books as pdfs. And highlight the parts I want to note. Since I am now reading them on an Android Tablet using Adobe Reader for Android, I need to find a way to move my highlights to a separate doc when I am done reading. I don't see

  • Problems with iTunes Version 6

    Please forgive me if this is a repeat of any kind. I searched on this issue and received way too many responses (mostly irrelevant!). When I try to launch certain radio stations in Version 6. It is sometimes difficult to even bring th station up. I s

  • MouseDragged - storing current and previous location positions

    hi, I've got to write a program where a shape moves around the screen according to an AffineTransform. When the user drags the shape the shape will move around the screen and when they release the button it will move in the appropriate direction with

  • Text overlapping / too high in all Mountain Lion apps (10.8.2)

    Hi everyone, hope someone is able to help me with this. I recently migrated to a new Macbook Pro Retina (15", 2.6GHz, 8GB ram) from my old Macbook Pro. Everything's going great, but I'm having problems with the Mountain Lion supplied apps. Much of th

  • Why Has Too Many Tabs Been Suddenly Removed?

    Firefox and add ons have been working fine. Following a crash I am now informed that Too Many Tabs 1.3.6 is not compatible with Firefox 3.6.18 . I don't want to upgrade because, usually, numerous add ons fail to work with upgrades and an upgrade tend