Skip to main content
February 23, 2009
Question

filtered recordset based on logged in user

  • February 23, 2009
  • 3 replies
  • 749 views
Creating a site in ASP with Dreamweaver cs3. I can build the login, insert, update & delete record pages ok, now I've got a summary page that I need to only display the records relating to the particular logged in user and not anyother users records; i.e. user1 should not be able to see any of user2's data, how can this be done???

Please assist and providing as much info on how to achieve this as possible, I'm new to Dreamweaver and dynamic page design in general, and I'm open to using different side server technology (PHP, MySQL, etc) to get what I need but it needs to be free!!!

Cheers
This topic has been closed for replies.

3 replies

Inspiring
February 25, 2009


This just joins two table together on the ID. In other words, only those
items where the two ids match are displayed.

SELECT P.ID AS ProductID, P.Name, P.ProdID, G.gid, G.pid AS Gpid, G.ord
FROM Table1 P
INNER JOIN table2 G ON P.ID = G.pid
ORDER BY G.gid

If you capture the email in a session, this will allow you to keep using
it if you need to bounce around between pages.

On the top of the page you are logging into, just write a session variable

ASP
<%
if (cStr(cStr(Request.Form("username"))) <> "") then
Session("ssUserNameID") = "" & cStr(cStr(Request.Form("UserName"))) & ""
end if
%>

And when you do your recordset, one of your variables is the Session
name ( in this case it's "ssUserNameID").

Does this make sense?
February 25, 2009
PHP can connect to other databases than the standard setup in Dreamweaver. I would recommend getting a book on developing dynamic websites using PHP & Dreamweaver; there are plenty of them in the bookstores.

Here is the link to the PHP documentation on the functions available to connect to and handle DB2 database queries.

http://www.php.net/manual/en/ref.ibm-db2.php

happy coding,
Inspiring
February 23, 2009
First of all, I would move away from ASP immediately; it's a dying, if
not a dead language.

Since .NET support in Dreamweaver is going away, that pretty much leaves
PHP and Cold Fusion.

As far as your question, when you log someone in, they've supplied you
with their unique username. You then create a recordset that pulls in
all information related to that username.

You probably need to do an INNER JOIN on two tables. Once you have that,
just "bind" them to the page. In other words, drag the tables from the
bindings window to the page.




February 24, 2009
Thanks Art for the info, spent the morning investigating PHP, installing locally and getting it working, only to find that Dreamweaver only allows you to connect to MySQL DB's with PHP pages, so this rules out using PHP as I need to connect to DB2 running on an IBM AS/400 (i/z series or what ever IBM wants to call it nowadays) and Coldfusion is out of the question due to the cost, as I said I have no money to spend so it needs to be free if i'm to change the server side technology; so I am pretty much left with ASP or ASP.net since I know even less about JSP pages than anything else on offer...

Could you eleborate further on binding the tables, inner joins, and what I would have to do to filter the recordset to only show that users records...
I was under the impression that I was somehow going to be using session variables based on the logged in username to achieve what I need..?

Is this the right line of thinking???
All comments appreciated.