Only Want to Return Listings for User (Full Version)

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



Message


nettop -> Only Want to Return Listings for User (3/9/2008 20:13:07)

I have a website where users register using the Spooky Login. I have sessions turned on. After a person is authorized, they enter new listings. I would like to show a page of just THEIR listings, so that I can let them edit only THEIR OWN listings. Thanks for your help, Tim

Here's my code (highlighted in red is where I'm trying to match the field name Agent_Email to the Session Name (which is the Spooky UserName):
<% ON ERROR RESUME NEXT
If cint(Session("AccessLevel")) < 3 Then 
Response.redirect "/authorized.asp?Redirect=" &Request.Servervariables("URL")
End if 
%>
<%
Dim mySessionUserName
mySessionUserName = Session.SessionUserName
%>
<html>

<head>
<% ' FP_ASP -- ASP Automatically generated by a Frontpage Component. Do not Edit.
FP_CharSet = "windows-1252"
FP_CodePage = 1252 %>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Results -- View</title>
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
</head>

<body bgcolor="#FFFFFF">

<table width="100%" align=left>
  <tr>
    <td width="50%">
	  <b><font size=+3 color="#000080"> Results Page </font></b>
	</td>
    <td width="50%" align=right>
      <table>
        <tr>
          <td>
		My Listings Page
| <a target="_top" href="editor/new.asp">Submission Form</a>
          </td>
        </tr>
      </table>
	</td>
  </tr>
</table>


<p>
<br clear="all">
<hr>
<p><% =Session("UserName") %>'s Listings With Paramount</p>
<table width="100%" border="1">
	<thead>
		<tr>
			<th ALIGN="LEFT"><b>ID</b></th>
			<th ALIGN="LEFT"><b>Agent_Email</b></th>
			<th ALIGN="LEFT"><b>Agent_Name</b></th>
			<th ALIGN="LEFT"><b>Owners_First_Name</b></th>
			<th ALIGN="LEFT"><b>Owners_Last_Name</b></th>
			<th ALIGN="LEFT"><b>Business_name</b></th>
			<th ALIGN="LEFT"><b>Street_Address</b></th>
			<th ALIGN="LEFT"><b>City</b></th>
			<th ALIGN="LEFT"><b>State</b></th>
			<th ALIGN="LEFT"><b>Status</b></th>
		</tr>
	</thead>
	<tbody>
		<!--#include file="../../_fpclass/fpdblib.inc"-->
<% if 0 then %>
<% end if %>
[color=#FF0000]<%
fp_sQry="SELECT * FROM Results WHERE (Agent_Email =  'Session(""UserName"")') ORDER BY ID DESC"[/color]fp_sDefault=""
fp_sNoRecords="<tr><td colspan=10 align=""LEFT"" width=""100%"">No records returned.</td></tr>"
fp_sDataConn="new"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&ID=3&VTI-GROUP=202&Owners_First_Name=202&Owners_Last_Name=202&Spouses_Name=202&Owners_Mailing_Address=202&Owners_City=202&Owners_State=202&Owners_Zip=202&Owners_Home_Phone=202&Owners_Cell_Phone=202&Owners_Fax=202&Owners_Email1=202&Owners_Email2=202&Description_and_price=202&Business_name=202&Street_Address=202&City=202&State=202&Zip=202&Detailed_Description=203&Type=202&Type_Number=202&Price=3&Area=202&Area_Number=202&Status=202&Status_Number=202&Page=202&Revenues=3&Adjusted_Net=3&Agent_Name=202&Agent_Email=202&Agent_Phone=202&Timestamp=202&Remote_computer_name=202&User_name=202&Browser_type=202&Timestamp1=135&"
fp_iDisplayCols=10
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="../../_fpclass/fpdbrgn1.inc"-->
<tr>
			<td>
			<%=FP_FieldVal(fp_rs,"ID")%></td>
			<td>
			<%=FP_FieldVal(fp_rs,"Agent_Email")%></td>
			<td>
			<%=FP_FieldVal(fp_rs,"Agent_Name")%></td>
			<td>
<%=FP_FieldVal(fp_rs,"Owners_First_Name")%></td>
			<td>
<%=FP_FieldVal(fp_rs,"Owners_Last_Name")%></td>
			<td>
<%=FP_FieldVal(fp_rs,"Business_name")%></td>
			<td>
<%=FP_FieldVal(fp_rs,"Street_Address")%></td>
			<td>
<%=FP_FieldVal(fp_rs,"City")%></td>
			<td>
<%=FP_FieldVal(fp_rs,"State")%></td>
			<td>
<%=FP_FieldVal(fp_rs,"Status")%></td>
		</tr>
<!--#include file="../../_fpclass/fpdbrgn2.inc"-->
</tbody>
</table>
</body>
</html>




Spooky -> RE: Only Want to Return Listings for User (3/9/2008 20:30:36)

Try it like so?

fp_sQry="SELECT * FROM Results WHERE (Agent_Email =  '"&Session("UserName")&"') ORDER BY ID DESC"




nettop -> RE: Only Want to Return Listings for User (3/10/2008 0:00:35)

Perfecto...I'm starting to get this 'sessions' thing down. The Spooky login tool has so MANY wonderful applications. Thanks for all of your hard work and help. Tim




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.046875