Session variable in the WHERE clause of the SQL statement

Hey all,.

I was wonering just if there is a way to set the WHERE clause of the query that the session variable?  I have the following so far and have tried to go through a ton of tutorials, but it doesn't seem to work.  Is it still possible?  I don't know what follows is wrong, but can someone help me with changing the following code, or pointing me to a good tutorial?  (I write it with PHP)

$query = "SELECT * from members where user_id = ' $_SESSION ['members']";

Thanks for your help.

$member = "-1";
If (isset($_SESSION['members'])) {}
$member = $_SESSION ['members'];

}
$query = "SELECT * from members where user_id = $member;

Tags: Dreamweaver

Similar Questions

  • Problem with a variable in the SQL statement variable

    Hello

    I try the following query.

    HSTMT = DBActivateSQL (hdbc, "UserLevel SELECT FROM ClassUsers WHERE Password =" + string + "");

    At this point, I get this error:

    Operands of + have illegal types "pointer to char" and "pointer to char".

    I tried this:

    HSTMT = DBActivateSQL (hdbc, "UserLevel SELECT FROM ClassUsers WHERE Password =" + & cadena + "");

    HSTMT = DBActivateSQL (hdbc, "UserLevel SELECT FROM ClassUsers WHERE Password = '" + string + "'");

    Still having the same problem.

    It works fine if I do this.

    HSTMT = DBActivateSQL (hdbc, "SELECT UserLevel UserClass WHERE the password =" cadena' "");

    Where "cadena" is treated as a string.

    Any ideas?

    Thank you!

    The Visual Basic method to concatenate strings with the + operator does not work in C. You can use a number of ways to do this - here is just a sample:

    char string [256] = "SELECT UserLevel OF ClassUsers WHERE password = ';"

    HSTMT = DBActivateSQL (hdbc, strcat (string, String));

    JR

  • Can we use repository variables in the SQL statement of the guest of the column?

    Hi guys,.
    This is the query
    SELECT '-End Date '. " End year"OF"The consumer sector"WHERE ("-End Date "." ") End of year' = valueof (current_year)) or ("-End Date". "") (Year-end' = valueof (current_year) - 1).
    When you use this sql prompt of criteria being of error.
    Please suggest.

    Thanks.Sri

    Appreciate if you score as correct on the suggestion

    Also your old messages, at least let us know your comments ;)

  • How to check the Session Variables using the analytical web dashboard

    This is my first post. Easy points to the first right answer... If I can figure out how to give points.

    Problem: I need to know how to check that the Session Variables with the Administration of Oracle BI tool are used by the web analytics tool.

    Environment: Windows running Oracle 10g BI. Connect to the database using web analytics http:// < server >: 9704/analytics, web analytics is running in a windows Explorer browser.

    Current situation: the analytical tool is connected to the database and I can use the screen of "Answers" to the table edge to probe the tables look and things as expected.
    In the administration Oracle BI tool I can see the session of web analytics and I see that he thinks that the Session Variables are set correctly.
    I have reasons to doubt that the analytical tool is to get the right variables and I need to check it out.
    I know that I should use the 'Answer' window to create a shape any of a query that includes NQ_SESSION. < my variable >, but I can't understand what the format should be doing the work.

    That's all I need.

    What I do is insert a text in my dashboard object and then set the properties of the text object to display the variable.

    for example to display the DISPLAYNAME variable, the text object properties are:

    User: @{biServer.variables ['NQ_SESSION.]} {[DISPLAYNAME']}

  • How can I add session variables for the subject field and the body of the e-mail Message?

    How can I add session variables for the subject field and the body of the e-mail Message? Tried several combinations, but do not seem to correct the syntax.

    This is the code I have. I need to change all the form variables in $msg in session variables. The $to part is supported. What remains are the $subject and $msg fields.

    $à = « à : ». $_SESSION ["toemail"];
    $subject = '$firstname $lastname, your registration details ';
    $from = "from: [email protected]"; "
    $msg = "Dear $title $firstname $lastname\r\n\nThank for the registration for the design of your dream Home.\r\nWe have received this following details details of you-\r\n\nClient-\r\n\nOccupation: $occupation \r\nPhone No.: $phone \r\nE-mail: $email\r\n\nPresent $ location: \r\n location\r\n\nPresent address: \r\n$ address\r\n\n\nFollowing are specified by you - design requirements \r\n\nBasic Features\r\n\nNo." floors: $floors\r\nNo. of bedrooms: bedrooms\r\nNo of $. of bathrooms: $bathrooms\r\nFloor region: $sqft\r\n\nFurther Suggestions: $ Plan\r\n\nSplit one further\r\n\n\nType floor: $splitfloor\r\n-remarks: $splitfloorremarks\r\nOpen floor: $openfloor\r\n-remarks: $openfloorremarks\r\n\n\nList of the rooms to be Included\r\n\nFoyer: $foyer\r\n-remarks: $foyerremarks\r\nDrawing: $drawing\r\n-remarks: $ alive drawingremarks\r\nFormal: $formalliving\r\n-comments : $ alive formallivingremarks\r\nFamily: $familyliving\r\n-remarks: $familylivingremarks\r\nHome Office: $homeoffice\r\n-remarks: $homeofficeremarks\r\nDining: $dining\r\n-remarks: $diningremarks\r\nMaster room: $master\r\n-remarks: $masterremarks\r\nMaster bathroom: $masterbath\r\n-remarks: $masterbathremarks\r\nMaster Dressing: $masterdress\r\n-remarks: $masterdressremarks\r\nBedroom: $bed\r\n-remarks: $bedremarks\r\nBathroom: $bath\r\n-remarks: $bathremarks\r\nDress: $dress\r\n-comments : $dressremarks\r\nStudy: $study\r\n-remarks: $studyremarks\r\nLibrary: $library\r\n-remarks: $libraryremarks\r\nPowder room: $powder\r\n-remarks: $powderremarks\r\nPrayer room: $prayer\r\n-remarks: $prayerremarks\r\nKitchen: $kitchen\r\n-remarks: $kitchenremarks\r\nPantry: $pantry\r\n-remarks: $pantryremarks\r\nUtility/area of work: $utility\r\n-remarks: $utilityremarks\r\nBalcony: $balcony\r\n-remarks: $balconyremarks\r\nStore: $store\r\n-remarks: $storeremarks\r\nLaundry : $laundry\r\n-remarks: $laundryremarks\r\nVeranda: $veranda\r\n-remarks: $verandaremarks\r\nCar porch: $carporch\r\n-remarks: $carporchremarks\r\nGarage: $garage\r\n-remarks: Theater garageremarks\r\nHome $: $theater\r\n-remarks: room of $theaterremarks\r\nMaid: $maid\r\n-remarks: $maidremarks\r\n\nOther general remarks: $general\r\n\nPlease note that the fields have been left blank in your form will be considered undecided details and used in discretion.\r\nIf of the architect , it better to add more later, design requirements please feel free to reply to this email with the details. « ;
    $fla = mail ($to, $subject, $msg, $from);

    Thanks in advance!

    askintrades wrote:

    How can I add session variables for the subject field and the body of the e-mail Message?

    What you want to do? Given the nature of your question, it seems that you probably don't know what a session variable is used. The PHP manual describes the purpose of sessions here: http://docs.php.net/manual/en/intro.session.php.

    I need to change all the form variables in $msg in session variables. The $to part is supported. What remains are the $subject and $msg fields.

    $à = « à : ». $_SESSION ["toemail"];

    Why do you need to change the form variables in session variables? They are already stored in session variables, or they come directly from the form?

    The $to part is not supported. When you pass $to to the mail() function, it should contain only an e-mail address, not a string that begins with "to:

  • How to assign groups to the Group Session variable in the initializtion box

    Hi all

    I have a requirement that I use a separate table for the table separately for the information of the user and group information.
    so in this same user belongs to multiple groups, so how do I assign these groups to single user
    I use external authentication of table...

    so everything will be done at the level of the session if, my problem is that I'm not able to assign multiple groups to single user,
    How to create the GROUP Session variable in the box initialization
    (here I'm horizontal initialization option)

    Please help me

    Thank you
    Françoise

    Thanks for the fence wire...

    Assign points if you feel that my post is correct and useful for your problem

  • How to create a session variable in the Apex?

    Hello dear colleagues,

    Is there a person know how to create a session variable in the Apex?

    How to get them?

    Thank you

    Best regards

    Hello

    No problem, PS don't forget to mark messages as 'useful' or 'correct', if you did infact find them useful or correct ;)

    John.
    --------------------------------------------
    Blog: http://jes.blogs.shellprompt.net
    Work: http://www.apex-evangelists.com
    Author of Pro Application Express: http://tinyurl.com/3gu7cd

  • problem with bind variables in the SQL query view object

    Hi all

    I use JDev 11.1.2.4.0.

    I have a problem with bind variables in the SQL query view object.

    This is my original SQL

    SELECT sum(t.TIME) , t.legertype_id
    FROM LEDGER t
    WHERE t.nctuser_id = '20022' 
          AND to_char(t.insertdate,'YYYYMMDD') in ('20130930','20130929')
    group by t.legertype_id
    

    In my view .xml object query tab, I am writing this

    SELECT sum(t.TIME) , t.legertype_id
    FROM LEDGER t
    WHERE   t.nctuser_id = '20022'
        AND to_char(t.insertdate,'YYYYMMDD') in :dddd
    group by t.legertype_id
    

    Davis here is a variable of Type liaison: String, updatable and necessary.

    I try to deal with Davis as ('20130930 ', ' 20130929') hoping the view object, run as my original SQL.

    But failed. The view object retrieves 0 line after that I run.

    Why?

    Thank you! ('2original SQL0130930', '20130929') ('20130930 ', ' 20130929')

    A variable binding cannot be used as this is why you must use years table. Check decompilation binary ADF: using oracle.jbo.domain.Array with ViewCriteria to see a solution.

    Timo

  • Set the Variable in the select statement

    Hello

    Can we define a variable in the select statement.

    Example:

    Select firstname, lastname
    employees;

    in this simple select statement we can define x as number?
    select fname,lname
    from employees
    where rownum <= 30;
    
  • call a function in a where clause of a select statement clause

    Hello

    is it possible to call a function in a where clause of a select statement clause?

    ex: select col1, col2
    from my_table
    where my_package.my_function (32199, 2008, col3, 'P');

    and I have the error message ' ORA-00920: invalid relational operator.

    FUNCTION ma_fonction (v_matricule in NUMBER,
    v_Year in NUMBERS
    T_DATE IN a DATE,
    v_type in DEFAULT CHAR 'P')
    RETURN A BOOLEAN VALUE;

    @+ Rosagio

    Yes, it is possible.

    But you have no relational operator:

    where my_package.my_function (32199, 2008, col3, 'P') =?
    where my_package.my_function (32199, 2008, col3, 'P') >?
    where my_package.my_function (32199, 2008, col3, 'P')<>

    Oops, I just noticed that your function returns a Boolean value.

    Can't do that as in a SQL statement.

    Boolean is known only to other code PL/SQL, no SQL statements.

    Published by: SomeoneElse on November 7, 2008 09:24

  • How can I pass a condition of the table in the sql statement?

    For example, in the table in the COND Varchar2 column (200) there is the value ' VAR > 10'.

    | COND |

    |' VAR > 10' |

    where VAR is the name of the table column. I would like to make statement CASE WHEN VAR > 10 AND 0... I tried with as subquery

    WHEN BOX (SELECT COND FROM TABLE WHERE...) THEN 0, but it does not work.

    Hello

    You can do this by using dynamic SQL.

    that is to say:

    declare
      v_stm      varchar2(4000);
      v_cond      varchar2(100);
      v_result    integer;
    begin
      select cond
        into v_cond
        from yourtable
      where a=1;
    
      v_stm := 'select case when '||v_cond||' then 0 ...';
    
      -- dynamic sql
      execute immediate v_stm
        into v_result;
    
    end;
    /
    

    Remember that, in general, dynamic SQL has a performance degradation that SQL static and should be avoided when possible.

    Storage condition or the SQL statements in the tables is not a good practice.

    Kind regards.

    Alberto

  • Identify the SQL statements that are executed frequently

    I would like to identify SQL statements that are executed may times (e.g., > 1000 times) during an interval AWR.

    I am aware of coloring a SQL_ID with exec ('...') dbms_workload_repository.add_colored_sql; but then the SQL ID must be known.

    Is it also possible to do the same for the (not yet known) SQL statements that are executed > 1000 times? I think that the SQL statements that run very quickly (for example 1 s <) won't be captured automatically in a CWA even if those statements are frequently performed.

    Version 11.2.0.4 on SLES11

    Try this...

    fixed lines 155

    execs from collar to 999 999 999

    Col min_etime to 999,999.99

    Col max_etime to 999,999.99

    Col avg_etime to 999,999.999

    Col avg_lio to 999,999,999.9

    Col norm_stddev to 999,999.9999

    Col begin_interval_time to a30

    node of col to 99999

    break on plan_hash_value on startup_time skip 1

    Select * from)

    Select sql_id, sum (execs), min (avg_etime) min_etime, max (avg_etime) max_etime stddev_etime/min (avg_etime) norm_stddev

    de)

    Select sql_id, execs, plan_hash_value, avg_etime,

    StdDev (avg_etime) on stddev_etime (sql_id partition)

    de)

    Select sql_id, plan_hash_value,.

    Sum (NVL(executions_delta,0)) execs,

    (sum (elapsed_time_delta) /decode (sum (nvl(executions_delta,0)), 0.1, sum (executions_delta)) / 1000000) avg_etime

    -sum ((buffer_gets_delta/decode (nvl(buffer_gets_delta,0), 0.1, executions_delta))) avg_lio

    DBA_HIST_SQLSTAT s, DBA_HIST_SNAPSHOT SS

    where ss.snap_id = S.snap_id

    and ss.instance_number = S.instance_number

    and executions_delta > 0

    Group of sql_id, plan_hash_value

    )

    )

    Group of sql_id, stddev_etime

    )

    where norm_stddev > nvl (to_number('&min_stddev'), 2)

    and max_etime > nvl (to_number('&min_etime'),.1)

    order of norm_stddev

    /

  • Get the SQL statement error programmatically

    Hello

    error SQL in the FORMS, you can display the erroneous SQL statement pressing (shift) (Ctrl) E on the screen. Is there a way to get the text of the SQL statement in a PL/SQL function for logging purposes?

    I get the error using SQLERRM, it's not a problem. But how can I get the SQL text of the statement?

    Thanks and regards,

    Sascha

    Sascha,

    You should be able to use the: SYSTEM. System LAST_QUERY variable forms.

    Craig...

  • copy and paste the sql statement into sql * more

    How do you paste the sql statement into sql * more... I tried the following options, get the windows interface for this sequel to the documentation below, but that did not work

    http://download.Oracle.com/docs/HTML/A88829_01/ch3.htm

    then I tried to create a simple .txt file with my sql statement and tried to run using @name (where name is the name of the file) and it gives me the following error SP2-0310: cannot open the file 'firstscriot.sql '.

    You name the file name.txt? Then you cannot start with @name, because SQL * PLUS will add the extension .sql

    Try instead the @name.txt or name the file name.sql

    And check if you have the correct path.

    Concerning
    Marcus

  • find sql_id using the sql statement, including the carriage return and tab...

    Hello. all.

    I wonder how to find sql_id using a sql statement, including transport retrun and tab space multiple.
    To be more precise,

    My sql is:

    Select
    col_a,
    col_b,
    ..
    ..

    I usually use the following query to find the sql_id

    Select sql_id in v$ sql where sql_text like 'MY SQL STATEMENT %.

    When MY SQL STATEMENT includes carriage return and tab space multiple, how can I do?

    Thanks in advance.
    Best regards.

    Hello

    Did you look at regular expressions? Use regexp_like instead of as.

    http://www.Stanford.edu/dept/ITSS/docs/Oracle/10G/server.101/b10759/conditions018.htm

    Kind regards

  • CALL THE PROCEDURE IN THE SQL STATEMENT

    Why we cannot call a procedure inside the SQL statement?

    Hello

    Usually when you select an item should return you data. In the case of a procedure, you cannot return any return value from the procedure directly it has to be done through some settings and to access these settings, you cannot use a simple sql statement. Where as in a function, you must return one of data that can be easily obtained accordingly.

    see you soon

    VT

Maybe you are looking for