|
| |
|
|
SerenityNet
Posts: 1364 Joined: 6/12/2001 From: Allen, TX, USA Status: offline
|
Using a Session Variable in DRW - 1/25/2002 1:24:25
Hi, I've got a session variable called "account" that I'm successfully passing between my pages. I have no problem capturing it (by using <%=session("account")%> ) and using it in forms posting to different database tables. However, I'm having ZERO success in using it as criteria to constrain database results. While in the DRW, I select "Custom Query" and have input: SELECT firstname, lastname, telephone, emailaddress, additional FROM UserData ORDER BY lastname ASC,firstname ASC The above works fine, but it is not constrained by the "account" session variable. I want to return only DB records where account = session(account). I've tried all sorts of ways to enter this, without success. I need help!!! Thanks in advance, Andrew Andrew<BR>webmaster@serenitynet.net<BR> - - - - - - - - - - - - <BR>"But the fruit of the Spirit is love, joy, peace, patience, kindness, goodness, faithfulness, gentleness, and self-control..." Gal. 5:22
|
|
|
|
Spooky
Posts: 26599 Joined: 11/11/1998 From: Middle Earth Status: offline
|
RE: Using a Session Variable in DRW - 1/25/2002 15:43:44
It will have to be a dieted DRW using : SELECT firstname, lastname, telephone, emailaddress, additional FROM UserData WHERE Account='"&Session("Account")&"' ORDER BY lastname ASC,firstname ASC This query can only be set in the red page code (no wizard) §þððk¥ Database / DRW Q & A VP-ASP Shopping cart Spooky Login
|
|
|
|
whitec00
Posts: 32 From: Dallas Texas USA Status: offline
|
RE: Using a Session Variable in DRW - 1/25/2002 21:32:06
Spooky, it never fails for me. I do exactly as you say, but I always get some type of error. The diet works fine, but the session variable parameter is not working. I get this error code: Database Results Error Description: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'username='. Number: -2147217900 (0x80040E14) Source: Microsoft OLE DB Provider for ODBC Drivers I want to personalize the page by pulling the username's actual first name. Here is my statement...what am I doing wrong here??? fp_sQry="SELECT * FROM user WHERE username="'&Session("username")&'"
|
|
|
|
SerenityNet
Posts: 1364 Joined: 6/12/2001 From: Allen, TX, USA Status: offline
|
RE: Using a Session Variable in DRW - 1/25/2002 21:53:37
Spooky, Thank you so much. The diet did the trick. It's now lean and mean. But maybe too lean and mean. I used to be able to have the "additional" field display as HTML code. Now it doesn't and I really want it to do that. Is there a way to have the field display HTML in its new lean version? WhiteC00 I've pasted my working code below, if it helps. <table> <tbody> <!--#include file="_fpclass/fpdblib.inc"--> <% fp_sQry="SELECT firstname, lastname, telephone, emailaddress, additional FROM UserData WHERE account='"&Session("Account")&"' ORDER BY lastname ASC,firstname ASC" fp_sDefault="" fp_sNoRecords="<tr><td colspan=5 align=left width=""100%""></td></tr>" fp_sDataConn="kit" fp_iMaxRecords=0 fp_iCommandType=1 fp_iPageSize=0 fp_fTableFormat=True fp_fMenuFormat=False fp_sMenuChoice="" fp_sMenuValue="" fp_iDisplayCols=5 fp_fCustomQuery=False BOTID=0 fp_iRegion=BOTID %> <!--#include file="_fpclass/fpdbrgn1.inc"--> <tr> <td> <b><br><%=FP_FieldVal(fp_rs,"firstname")%> <%=FP_FieldVal(fp_rs,"lastname")%></b><br> <%=FP_FieldVal(fp_rs,"telephone")%><br> <%=FP_FieldVal(fp_rs,"emailaddress")%><br> <%=FP_Field(fp_rs,"additional")%><br><br> </td> </tr> <!--#include file="_fpclass/fpdbrgn2.inc"--> </tbody> </table> Andrew<BR>webmaster@serenitynet.net<BR> - - - - - - - - - - - - <BR>"But the fruit of the Spirit is love, joy, peace, patience, kindness, goodness, faithfulness, gentleness, and self-control..." Gal. 5:22
|
|
|
|
Spooky
Posts: 26599 Joined: 11/11/1998 From: Middle Earth Status: offline
|
RE: Using a Session Variable in DRW - 1/26/2002 16:51:09
When you say "display html" do you mean have your text formatted with html , or show the raw code like <b>text</b>? <%=FP_Field(fp_rs,"additional")%> should send the code to the page with no formating whatsoever. ie youd get text §þððk¥ Database / DRW Q & A VP-ASP Shopping cart Spooky Login
|
|
|
|
Spooky
Posts: 26599 Joined: 11/11/1998 From: Middle Earth Status: offline
|
RE: Using a Session Variable in DRW - 1/26/2002 16:53:08
WhiteC00 - your qoutess are around the wrong way :) fp_sQry="SELECT * FROM user WHERE username= ' " &Session("username")& " ' " The spaces are for clarity only! §þððk¥ Database / DRW Q & A VP-ASP Shopping cart Spooky Login
|
|
|
|
whitec00
Posts: 32 From: Dallas Texas USA Status: offline
|
RE: Using a Session Variable in DRW - 1/26/2002 16:59:29
The smallest details need to be emphasized in my brain somehow.... The problem was that I needed a closing quote after the last quote in the script. It works now. Thanks !!!! Where's the "any" key?
|
|
|
|
SerenityNet
Posts: 1364 Joined: 6/12/2001 From: Allen, TX, USA Status: offline
|
RE: Using a Session Variable in DRW - 1/26/2002 17:23:39
Thanks everyone. RE: "Display HTML" Yes, I meant and want to show text formatted by HTML code. I don't want the tags displayed or printed. Thanks, Andrew Andrew webmaster@serenitynet.netBut the fruit of the Spirit is love, joy, peace, patience, kindness, goodness, faithfulness, gentleness, and self-control..." Gal. 5:22
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|