SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseSQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old January 12th, 2004, 06:54 AM
ThePaulius ThePaulius is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: London
Posts: 17 ThePaulius User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #2  
Old January 12th, 2004, 08:50 AM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
Click here for more information.
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,781 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 8 h 45 m 55 sec
Reputation Power: 470
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

Reply With Quote
  #3  
Old January 12th, 2004, 09:42 AM
ThePaulius ThePaulius is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: London
Posts: 17 ThePaulius User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > SELECT * WHERE cell = cookie data


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT