how to link db to login to display records of user only (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


winter -> how to link db to login to display records of user only (8/6/2007 0:06:31)

Is there a simple way to set up a page (using FP2003) that shows only the data base records for the person who has logged in?

I have the Spooky Login system nicely installed. There is one other database in the fpdb folder and 10 forms post to this data base using the same fields. In each of the forms I have placed a hidden field using Name: Lastname and Value: <%=Session("x_Lastname")%> (from the login system).

When they have logged in, I would like the user to be able to go to a page where they can find all of their own entries (3-4 fields per entry) to date. (it’s like a diary)

I tried using DBR wizard but then each person would need their own page. Is it possible to have one page act like a ‘session’ and just show results for the person logged in?

Guidance appreciated!




Spooky -> RE: how to link db to login to display records of user only (8/6/2007 15:51:34)

The way to do it, is to use a DRW however you want to customize the DRW to use one of the session values from the login.
Perhaps lastname is not a value that should be used in case there are many 'smiths' for example?
Ideally, the record in the other database should be associated by an ID or other unique identifier

DRW :
fp_sQry = "Select * from table where ID=::ID::"
becomes :
fp_sQry = "Select * from table where ID="&Session("UserID")




winter -> RE: how to link db to login to display records of user only (8/7/2007 22:49:54)

quote:

fp_sQry = "Select * from table where ID="&Session("UserID")


Thanks so much Spooky, but I get an error message. Here is what I did...

Insert /Database/Results - using wizard
Select DB - mydatabase
Custom Query/Edit
Insert Parameter /Name /Enter- ::UserID::

At this point I paste in the code from you
fp_sQry = "Select * from table where ID="&Session("UserID")

but get the error message "the Server encountered an error..."

I then tried pasting that expression in the code view of the page where it says in red

fp_sQry="SELECT * FROM Results" but that did not work either.

Any suggestions?

With Appreciation
Carolyn




winter -> RE: how to link db to login to display records of user only (8/15/2007 9:35:25)

Hi Spooky,

Your suggestion makes good sense to me and i have been trying for days to make it work. I tried using UserID and in the code area put in this:

fp_sQry="SELECT * FROM Results WHERE (UserID= '<%=Session(""x_UserID"")%>')"

and either get page not found once published or the following message when i take out the double quote to make it a single:

"the contents of a FP component have been modified. THese will be changed when you press Save."

...and of course they are!

I tried putting that expression into the DRW directly either as a query or in the section for other criteria but that does not work either.

Any other ideas? What am i missing?

Thanks so much,

Carolyn




Spooky -> RE: how to link db to login to display records of user only (8/15/2007 16:09:26)

fp_sQry="SELECT * FROM Results WHERE (UserID="&Session("UserID")&")"




winter -> RE: how to link db to login to display records of user only (8/15/2007 22:04:17)

quote:

fp_sQry="SELECT * FROM Results WHERE (UserID="&Session("UserID")&")"


Hi Spooky,

I tried this but when i type this into code view still get the error message: "the contents of a frontpage component have been modified. These contents will be over written when you save the page."

- or "the server encountered an error when i insert it in the wizare panel for edit query.

I do notice in the DRW steps that when you are asked to select a db/ the main one i am working with is in the list, but the login db is not in the list. The login DB i know is there and working fine, but i don't know why it would not show in the list. ALso when i check tools/site parameters/database connections - the login db is not on that green checkmarked list. It's like a ghost really ( very spooky if you ask me).

Could this be the problem?

Your thoughts appreciated.

By the way, in working through this i have read your tutorial on DRW and really, - it is very helpful.




Spooky -> RE: how to link db to login to display records of user only (8/15/2007 23:28:08)

Its probably best to apply the spooky diet first - then you can modify the asp (as above) directly




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.078125