Print Page | Close Window

how to make a sql that having 2 where !?

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=10612
Printed Date: 29 March 2026 at 11:44pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: how to make a sql that having 2 where !?
Posted By: want2learn
Subject: how to make a sql that having 2 where !?
Date Posted: 26 May 2004 at 6:12pm
Hi

I have this code:

Set objRS = Server.CreateObject("ADODB.Recordset")
strSQL = "Select * From nameslist where PersonName = '" & Request.form("A") & "'"
objRS.Open strSQL, objConn, 1, 3

If Not (objRS.BOF Or objRS.EOF) Then
Response.Redirect "tilmeld.asp?error=The name is in USE/make another !"
End If


I want it to work as now, but I want it to say that "if Request.Form("A") is int the DB it should make theerror tilmeld.asp?error=The name....
(IT WORKS)
But how can i make something with
where PersonIP = '" & Request.ServerVariables("REMOTE_ADDR") & "'" So i can get it 2 make a new error
Response.Redirect "tilmeld.asp?error=U have make one name with this IP !"

also i want it 2 check if the Request.ServerVariables("REMOTE_ADDR") is ind the DB then error else/elsenot if the Request.form("A") is in the DB, and if is is then error else

objRS.AddNew
objRS("PersonName") = AA
objRS("PersonIP") = Request.ServerVariables("REMOTE_ADDR")
objRS.Update

hope U understand me !!




Replies:
Posted By: dpyers
Date Posted: 26 May 2004 at 8:07pm

One way of dealing with this is to add an OR to the end of your sqlstring
OR PersonIP = '" & Request.ServerVariables("REMOTE_ADDR") & "'"

This will give you a record set with any records that meet either criteria. Loop through the record set and if you find the PersonName, spit out the error. If you find the IP, spit out that error. If the record set has no members, the query didn't find either the IP or the name.

Please note that in the US at least, most people are on dynamic IP's. I may have the IP today, and my neighbor may have it tomorrow. Also, some client-side security software hides parts of the http headers. Norton Internet products hide the http_referrer, and I think - but don't know - that Norton Internet Security also plays with the IP.



-------------

Lead me not into temptation... I know the short cut, follow me.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net