Forums
This topic is locked
Filter Records Based on UserID
Posted 29 Jun 2007 21:46:02
1
has voted
29 Jun 2007 21:46:02 almahdi ali posted:
Hi to all, i will gladly appreciate any assistance on the following:Im using Dreamweaver to build a product catalog. I want that when users sign into my website, they are taken to a page showing them their favorite product categories. I have already built the user log in, and i have built the recordset to show product category name. I filtered the recordset by "userid" and the default value in the advanced recordset appears as "1". My problem is that when any user signs in, they see the categories for the user of userid "1" which is the default value.
I tried removing the default value, but then it returns no data on when any user logs in. I tried using the Like statement is the SQL with the % wild card...but then it returns all categories as if there was no filter. So if sam signs in.....i want that sam sees his favorite categories. If Joes signs in i want joe to see his favorties categories ......and so on. PLEEEEZE HELP!
This is the code for the recordset and the filter....:
<%
Dim rsFavorite_Categories__MMColParam
rsFavorite_Categories__MMColParam = "1"
If (Request.QueryString("usrid" <> "" Then
rsFavorite_Categories__MMColParam = Request.QueryString("usrid"
End If
%>
<%
Dim rsFavorite_Categories
Dim rsFavorite_Categories_numRows
Set rsFavorite_Categories = Server.CreateObject("ADODB.Recordset"
rsFavorite_Categories.ActiveConnection = MM_connpractise_STRING
rsFavorite_Categories.Source = "SELECT * FROM FvrtsCtgrs WHERE usrid = " + Replace(rsFavorite_Categories__MMColParam, "'", "''" + " ORDER BY ctgrynme ASC"
rsFavorite_Categories.CursorType = 0
rsFavorite_Categories.CursorLocation = 2
rsFavorite_Categories.LockType = 1
rsFavorite_Categories.Open()
rsFavorite_Categories_numRows = 0
%>