Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - how to make a sql that having 2 where !?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

how to make a sql that having 2 where !?

 Post Reply Post Reply
Author
want2learn View Drop Down
Newbie
Newbie


Joined: 19 May 2004
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote want2learn Quote  Post ReplyReply Direct Link To This Post Topic: how to make a sql that having 2 where !?
    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 !!

Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post 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.



Edited by dpyers

Lead me not into temptation... I know the short cut, follow me.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.