How do i filter recordsets using session variable???  Please help this is driving me mad...!!

I am having the same problem as user "Gabe the animator" in a post sent in 2007.
"my recordset that drives a dynamic table won't filter results based on a session variable. I know session variables are working because I have the session variable echo on the page (dragged-n-dropped my session variable from the Bindings panel to my page), and that works fine. So why can't I filter my recordset with the same session variable???"
here is the code:
<?php require_once('Connections/mockconn.php'); ?>
<?php
session_start();
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;   
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  return $theValue;
if(!session_id()){
session_start();
$colname_info = "-1";
if (isset($_SESSION['email'])) {
  $colname_info = $_SESSION['email'];
mysql_select_db($database_mockconn, $mockconn);
$query_info = sprintf("SELECT name, last_name, email, password FROM registration WHERE email = %s", GetSQLValueString($colname_info, "text"));
$info = mysql_query($query_info, $mockconn) or die(mysql_error());
$row_info = mysql_fetch_assoc($info);
$totalRows_info = mysql_num_rows($info);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>home</title>
</head>
<body>
<div id="info">hello <?php echo $row_info['']; ?></div>
<?php
if (isset($_SESSION['email'])) {
          echo 'your email: '.' '. $_SESSION['email'] .' '.'good job';}
                    ?>
</body>
</html>
PLEASE PLEASE HELP.... I have been at this for day's...
how do I get the record set to filter based on the value of the session variable

Sorry I forgot to mension the error I am getting?
( ! ) Notice: Undefined index: in C:\wamp\www\mock\home.php on line 59
Call Stack
Time
Memory
Function
Location
1
0.0093
389024
{main}( )
..\home.php:0
Why is this error coming up?

Similar Messages

  • Activation Problem..i Have Registered for the devolopers account and also paid 99 dollars. how do i open my iphone now? please help. this is urgent!

    this morning my iphone showed up a activation problem then it told me to go to devoloper.apple.com and register for the ios developer program.. it costed me 99 dollars. but i did it.. just a moment ago.. how do i access my iphone now? please help me this is real urgent.

    this in my problem too apple say : ur request is pending now and it did not activated yet !    ?  
    what should i do?

  • Alternate method to writing filter for recordset using session variable

    I'm not sure if this can be done.  I have a user page which I'd like to return database info based upon a userid entered on another page. So far, the session variable (userid) is captured on the user page however it is supposed to return the user's name rather than displaying the session variable.
    My problem is this. Within dreamweaver, I am able to create recordsets however I cannot create a filter. The connection works. At this point, I am searching for a workaround where I can tie in the session variable to recordsets. I should make mention that whenever I update the sql statement using the recordset widget, my recordset disappears. ?  At any rate, heres a sample of the code sans connection strings, etc.
    <%
    Dim Recordset1
    Dim Recordset1_cmd
    Dim Recordset1_numRows
    Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
    Recordset1_cmd.ActiveConnection = MM_newuniversity1_STRING
    Recordset1_cmd.CommandText = "SELECT name FROM table WHERE userid =  '" & Session("userid_my") & "'"
    Recordset1_cmd.Prepared = true
    Set Recordset1 = Recordset1_cmd.Execute
    Recordset1_numRows = 0
    %>
    On the user page, I have a 'Welcome' and the following code
    {Request.userid_my}
    Any suggestions? I'm afraid I'm a newbie to asp within dreamweaver cs3.

    >When I insert  request.userid_my code it returns the session variable
    AFAIK, session variables are not part of the request object - so I do not understand why you are referencing them this way. I would use the standard reference method : Welcome <%Response.Write(Session("username"))%>
    >when I insert the recordset associated with 'name' I get an Adobe End of file error. ?
    Sounds like a possible problem with your installation. You may need to try reinstalling DW. How are you "inserting" this recordset and when does the error occur?
    Regarding your next post...
    >select name from table_name where userid = '" & namemy & "'"
    >The statement consistently returns a 'quoted string not properly terminated' error.....
    The select statement you quoted is obviously not complete. If you are refering to the select in your OP:
    Recordset1_cmd.CommandText = "SELECT name FROM table WHERE userid =  '" & Session("userid_my") & "'"
    I see nothing wrong with that syntax and the string appears to be terminated correctly. If there is a different statement causing the error, please post the entire line and include a line above and below.

  • Filter recordset with session variable

    This has never happened to me before, but for some reason, my
    recordset that drives a dynamic table won't filter results based on
    a session variable. I know session variables are working because I
    have the session variable echo on the page (dragged-n-dropped my
    session variable from the Bindings panel to my page), and that
    works fine. So why can't I filter my recordset with the same
    session variable??? What's going on?
    PS: I've attached my result page's code to this
    message.

    Gabe the Animator wrote:
    > <?php require_once('Connections/sales.php'); ?>
    > <?php
    > if (!function_exists("GetSQLValueString")) {
    > function GetSQLValueString($theValue, $theType,
    $theDefinedValue = "",
    > $theNotDefinedValue = "")
    > {
    > $theValue = get_magic_quotes_gpc() ?
    stripslashes($theValue) : $theValue;
    >
    > $theValue = function_exists("mysql_real_escape_string")
    > mysql_real_escape_string($theValue) :
    mysql_escape_string($theValue);
    >
    > switch ($theType) {
    > case "text":
    > $theValue = ($theValue != "") ? "'" . $theValue . "'" :
    "NULL";
    > break;
    > case "long":
    > case "int":
    > $theValue = ($theValue != "") ? intval($theValue) :
    "NULL";
    > break;
    > case "double":
    > $theValue = ($theValue != "") ? "'" .
    doubleval($theValue) . "'" :
    > "NULL";
    > break;
    > case "date":
    > $theValue = ($theValue != "") ? "'" . $theValue . "'" :
    "NULL";
    > break;
    > case "defined":
    > $theValue = ($theValue != "") ? $theDefinedValue :
    $theNotDefinedValue;
    > break;
    > }
    > return $theValue;
    > }
    > }
    >
    > $colname_rsSales = "-1";
    > if (isset($_SESSION['state'])) {
    > $colname_rsSales = $_SESSION['state'];
    > }
    > mysql_select_db($database_sales, $sales);
    > $query_rsSales = sprintf("SELECT * FROM sales WHERE city
    = %s",
    > GetSQLValueString($colname_rsSales, "text"));
    > $rsSales = mysql_query($query_rsSales, $sales) or
    die(mysql_error());
    > $row_rsSales = mysql_fetch_assoc($rsSales);
    > $totalRows_rsSales = mysql_num_rows($rsSales);
    >
    > session_start(); ?>
    The issue is that PHP doesn't "work" with session values
    until the session has started, and that must be done on each page,
    and must be done in the code *above* any reference to a session
    variable. The code you posted has the session_start() after it
    tries to use the session value ito filter the recordset. So move
    this last line of code ( session_start(); ) above $colnam_rsSales =
    "-1". Better yet, use:
    if(!session_id()){
    session_start();
    To prevent some versions of PHP from generating a
    warning/notice if you've called session_start() on the page already
    and you call it again.
    Danilo Celic
    | Extending Knowledge Daily :
    http://CommunityMX.com/
    | Adobe Community Expert

  • How to build dynamic menus using JSP==Urgent==Please Help me

    Hello,
    I have exhausted searching on internet to find a book
    which tells how to build Dynmic menus in JSP.I dont want
    to use DHTML as this becomes complex as the menu categories
    are built using data from database.Is there any workaround in
    java to do this without DHTML or atleast sample code.
    can somebody help me in this regard.
    Thanks
    Jack

    Hello a.s.kumar,
    I would be greatful if you could send me the sample code.
    [email protected]
    we can't let MM Flash run away with the show can we. Javascript can do a decent job, but the underlying menu data is static.
    Cheers, Darren

  • How can we use Session Variable in Answers or Analysis?

    How can we use Session Variable in Answers or Analysis?

    Again, duplicate cross-posting!
    See rukbat 's post here: Re: BI Apps 7.9.6.3(Agent Issue)

  • Filter Recordset by a Variable - HELP!!

    I'm using ASP/VBSCRIPT with an Access database.
    I have a variable that contains multiple email address, for
    example
    Dim Var1
    Var1 = [email protected], [email protected],
    [email protected]
    How do I filter a recordset using that variable. How do I
    retrive the records on the database that contain those email
    address.
    Any one has an asnwer?
    Please advise. Thanks!

    Will you always know how many variables there are, or will
    the number be
    dependent on user action?
    I'm thinking you should probably have an array, and work
    through it to get a
    list of variables, the present those to your SQL statement in
    an
    IF Email == Var1 OR Email = Var2 OR
    But I'm not sure how you'll do it if you have a number of
    variables you
    don't know?
    I'll check back in a bit if no solutions have been offered.
    "FLEQUE" <[email protected]> wrote in
    message
    news:eeu92f$8r2$[email protected]..
    > I'm using ASP/VBSCRIPT with an Access database.
    >
    > I have a variable that contains multiple email address,
    for example
    >
    > Dim Var1
    > Var1 = [email protected], [email protected],
    [email protected]
    >
    > How do I filter a recordset using that variable. How do
    I retrive the
    > records
    > on the database that contain those email address.
    >
    > Please advise. Thanks!
    >

  • Use session variable in Insert record

    Help, please!
    I need to add a record to a table; one of the fields in the
    table is the user_id. When I try to use the insert record server
    behavior, there is no way to select the user_id session variable!
    How is this done?

    .oO(Ted Dawson)
    >>>> to select the user_id session variable! How
    is this done?
    >>>
    >>>Use a hidden variable in the form, and assign it
    the value of the session.
    >>
    >> And what if the user manipulates that value? Hidden
    form fields _always_
    >> require a validation on the server. One purpose of a
    session is to avoid
    >> that sensitive data is sent to the client, where it
    can be manipulated.
    >
    >
    >Exactly how is the value of a SESSION VARIABLE
    manipulated by the client?
    It can be manipulated if it's put into a hidden form field.
    Micha

  • Setting VO bind variable using session variable

    Hi,
    I need to get/set VO bind variable using ApplicationModuleImple or ViewObjectImple class. Does Any one know how to do it?
    I have one VO based on query like "select name from users where password = :password ". I had a bind variable to it too. now i want to set it from a session scoped variable. can i do it using ADFContext.getCurrent().getSession().get('username'); ? but somehow I am not able to get the knowledge i.e where to set bind variable. please help.

    Timo thanks for the reply, actually I don't want to do it using data control i.e drag and drop method to a page. Instead i just want to set bind variable to a session varable already got from login page.
    I got the following sollotion but don't know where to put them,
    1.
    FacesContext context = FacesContext.getCurrentInstance();
    ValueBinding vb = context.getApplication().createValueBinding("#{data}");
    BindingContext bci = (BindingContext)vb.getValue(context);
    DCDataControl dc = bci.findDataControl("AppModuleDataControl");
    ApplicationModule am = (ApplicationModule)dc.getDataProvider();
    AppModuleImpl service = (AppModuleImpl)am;
    ViewObject vo = service.findViewObject("YourViewObject").setNamedWhereClauseParam("nameBindVariable", objectValue);
    vo.executeQuery();
    what is the #{data} in second line ? if you know please let me know.
    Second Solution :
    2- In backing bean code:
    FacesContext context = FacesContext.getCurrentInstance();
    Application fapp = context.getApplication();
    JUFormBinding adfbc = (JUFormBinding)fapp.createValueBinding("#{bindings}").getValue(context);
    DCIteratorBinding iter = adfbc.findIteratorBinding("YourIterator");
    iter.getViewObject().setNamedWhereClauseParam("nameBindVariable", objectValue);
    iter.executeQuery();
    where would I get "YourIterator" ... ? I am still a new at jdev ... ;)

  • Can we use session variables in BI publisher's Data Model SQL Query?

    Hi Experts,
    We need to implement Data level security in BI Publisher 11g.
    In OBIEE we do so by using session variables, so just wanted to ask if we can use the same session variables in BI Publisher as well
    ie can we include the where clause in the Data Models SQL Query like
    Where ORG_ID = @{biServer.variables['NQ_SESSION.INV_ORG']}
    Let me know your views on this.
    PS: We are implementing EBS r12 security in BI Publisher.
    Thanks

    Read this -> OBIEE 11g: Error: "[nQSError: 23006] The session variable, NQ_SESSION.LAN_INT, has no value definition." when Creating a SQL Query using the session variable NQ_SESSION.LAN_INT in BI Publisher [ID 1511676.1]
    Follow the ER - BUG:13607750 - NEED TO BE ABLE TO SET A SESSION VARIABLE IN OBIEE AND USE IT IN BI PUBLISHER
    HTH,
    SVS

  • Use Session Variable with row-wise initialization

    Hello,
    I use an initialization block in order to load some translations in my repository (version is 11.1.1.6.BP1) :
    SQL :
    SELECT CODE_KEY, STRING_VALUE FROM "TABLES" WHERE  LANGUAGE_KEY= 'VALUEOF(NQ_SESSION.USERLOCALE)'
    Values :
    CN_INCOMING, Incoming, en
    CN_OUTGOING, Outgoing, en
    CN_INCOMING, Réception, fr
    CN_OUTGOING, Emission, fr
    etc ...
    I checked the row-wise intialization.
    The query is correct and returns the right values (I check in the log file ..).
    So far, So good.
    But when I want to use session variables in a column expression (in repository) like  :
    CASE WHEN "column"="xx" THEN VALUEOF(NQ_SESSION."CN_INCOMING")  ELSE VALUEOF(NQ_SESSION."CN_OUTGOING") END
    I got the error: [nQSError: 23006] The session variable, NQ_SESSION.CN_OUTGOING, has no value definition.
    If I used the same formula directly in Answers it's working correctly.
    Do I have to necessarily do this in answers or is there a way to do this in the repository.
    Thanks in advance
    Regards
    Benjamin

    Yes I already tested this point, when I don't use a row wise initialization it's working, but I don't want to create one variable for each translations that I need to use in column formula if you know what I mean.
    I don't understand why we can't use this kind of variable in this context ..but if I have to create the column in my analysis, I will do that, but it's not really user friendly
    Anyway thanks for your time.

  • Page Specific Persistence using Session Variables

    Hi, I have read a lot about using session variables to persist the ReportDocument object across page loads.  This works fine if you have just one page open with one report.  The problem I am having is I have a web application that makes 30 or 40 different reports available to the user.  To simplify the code and make it easier to add new reports I have developed a single template aspx page that can be used to view any of the reports.
    My problem is that if the user opens 2 different reports in 2 separate tabs in the browser then the session variable persistence doesn't work because the session variable is available to both tabs.
    Is there a way to persist the ReportDocument object which is 'page' specific.
    Thanks

    Your best option is likely to have something that makes the session variable names unique.  I've done such things as putting the current datetime in the url as a querystring parameter and appending that to the variable name.  On each postback that querystring should persist.
    You might be able to use the reportclientdocument object and serialize the report and persist through view state, haven't tried this with inproc ras though.  A sample that uses the ras sdk can be found [here|http://wiki.sdn.sap.com/wiki/display/BOBJ/NETRASSDK+Samples]

  • Dates Format in Promts using Session Variables

    Hi Experts,
    I have an issue in controlling date format in prompts using session variable which I am using to set default value.
    By default date format is timestamp E.g '2010-12-19 12:00:00 AM'.
    As per requriement(s) I customized the date format in Reports as 19-Dec-2010 and I saved it as "System Wide Default for <Date Column Name> "
    So, I got desired format in Reports and Date Prompts.
    Now, I need to set a default value in Date Prompt. So, in RPD I created a Session Variable which returned me date in
    DD-MON-YYYY format. Using follwing SQL :
    SELECT REPLACE(CONVERT(VARCHAR(11), Getdate (), 106), ' ', '-') AS [DD-Mon-YYYY]
    But in reports takes this value as string and not Datetime. So i got an error message.
    A datetime value was expected (received "19-Dec-2010").
    If i do not use above SQL to CONVERT date then default date in prompt get displayed as timestamp format and give me desired results but Formatting looks very odd in prompt
    Is this a way so I can persist the [DD-Mon-YYYY] Formatting for default value which comes using variable and still run the report.
    Above problem also exist vice versa that is if i SET that session variable and pass the datetime value to server. But there i guess I can use ToDate or some Casting in RPD column expression to handle that. Tell me if i am right ?
    Thanks
    Saurabh

    That almost works. I had to adjust the syntax to the following...and then there are other issues doing this.
    select cust_no, name,'@{session.currentUser}' from customersMy write-back SQL is this:
    UPDATE customers SET NAME='@{c1}',LAST_EDITED_BY='@{c2}' WHERE CUST_NO=@{c0}But I don't want to display the cust_no column to the user. So I hide it in the UI. But if I do that I get the below error during write-back. Apparently sometimes when you hide a column on a direct query (numeric maybe?) the value doesn't transfer over to the write-back. If that's the case, this won't work for me. Hmm...
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43093] An error occurred while processing the EXECUTE PHYSICAL statement. [nQSError: 17001] Oracle Error code: 936, message: ORA-00936: missing expression at OCI call OCIStmtExecute: UPDATE customers SET NAME='Wyatt Donnely',LAST_EDITED_BY='Administrator' WHERE CUST_NO= . [nQSError: 17011] SQL statement execution failed. (HY000)
    SQL Issued: EXECUTE PHYSICAL CONNECTION POOL dev1 UPDATE customers SET NAME='Wyatt Donnely',LAST_EDITED_BY='Administrator' WHERE CUST_NO=

  • Sticky using session variables

    Hello
    I was wondering if it is possible to stick a session to a server using session variables (such as username) Currently I am using cookies to keep the session sticky but i also need to use the session variables.
    Thanks
    Donagh

    Donagh,
    there is absolutely no reason to use both.
    If the name is more important, than use the name.
    If the cookie is more important, than use the cookie.
    If one is not more important than the other, then keep using the cookie.
    Another way to see it is :
    if the name and the cookie refer to the same server, it does not matter which one you use.
    But if they point to different servers.
    What do you do ?
    Which information do you use to select the server ?
    The name or the cookie ?
    As I said, there is no reason to use both.
    Unless if one is missing.
    But the problem is then to make sure it is always there.
    Is there any stickyness issue currently ?
    Gilles.

  • In iOS 5 on the iphone 3gs, how does one disable voice control, not voice dailing.  I have never wanted or used voice control please help me disable it.

    In iOS 5 on the iphone 3gs, how does one disable voice control, not voice dailing.  I have never wanted or used voice control please help me disable it. 

    are you talking about voiceover where the phone is reading things out loud to you? you have to double tap things in voiceover in order to select them. you'll need to go to settings > general > accessibility > and turn off voiceover there

Maybe you are looking for