|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
SELECT * WHERE cell = cookie data
Hi, i need to display the name of a user on a 'confirm page'. request.form wont work, im now using a cookie.
The user has already inputted his membership number which is a unique identifyer. how do i tell SQL to bring back only the row which starts with the membership number contained in the cookie? maybe this will demostrate what im trying to do. Dim memRS Dim memRS_numRows Dim memNumber memNumber = Request.Cookies("memberCookie") Set memRS = Server.CreateObject("ADODB.Recordset") memRS.ActiveConnection = MM_Poll_YMS_STRING memRS.Source = "SELECT * FROM dbo.Member_Data WHERE Member_Num = ('memNumber' )" memRS.CursorType = 0 memRS.CursorLocation = 2 memRS.LockType = 1 memRS.Open() later on i will have to make it check that that user has voted only once, but i'll be back for that no doubt. |
|
#2
|
||||
|
||||
|
you didn't specify which database you were using or the data type of the memNumber field, so...
try this Code:
memRS.Source = "SELECT * FROM dbo.Member_Data WHERE Member_Num = " & memNumber |
|
#3
|
|||
|
|||
|
Ooooh, was just about to give up! cheers mate
heres the results page, its a real shame i couldnt get it to work with just REQUEST.FORM.. *sigh* Code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/Poll_YMS.asp" -->
<%
Dim memRS
Dim memRS_numRows
Dim memNumber
memNumber = Request.Cookies("memberCookie")
Set memRS = Server.CreateObject("ADODB.Recordset")
memRS.ActiveConnection = MM_Poll_YMS_STRING
memRS.Source = "SELECT * FROM dbo.Member_Data WHERE Member_Num = " & memNumber
memRS.CursorType = 0
memRS.CursorLocation = 2
memRS.LockType = 1
memRS.Open()
memRS_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = 10
Repeat1__index = 0
memRS_numRows = memRS_numRows + Repeat1__numRows
%>
<HTML>
<HEAD>
<TITLE>Untitled Document</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
</HEAD>
<BODY>
<table border="0" cellspacing="5">
<tr>
<td>ID</td>
<td>Member_Num</td>
<td>First_Name</td>
<td>Last_Name</td>
<td>DOB</td>
<td>Email</td>
</tr>
<% While ((Repeat1__numRows <> 0) AND (NOT memRS.EOF)) %>
<tr>
<td><%=(memRS.Fields.Item("ID").Value)%></td>
<td><%=(memRS.Fields.Item("Member_Num").Value)%></td>
<td><%=(memRS.Fields.Item("First_Name").Value)%></td>
<td><%=(memRS.Fields.Item("Last_Name").Value)%></td>
<td><%=(memRS.Fields.Item("DOB").Value)%></td>
<td><%=(memRS.Fields.Item("Email").Value)%></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
memRS.MoveNext()
Wend
%>
</table>
</BODY>
</HTML>
<%
memRS.Close()
Set memRS = Nothing
%>
Last edited by ThePaulius : January 12th, 2004 at 10:00 AM. |
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > SELECT * WHERE cell = cookie data |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|