Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Help With Code
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Help With Code

 Post Reply Post Reply Page  <123
Author
snapey View Drop Down
Newbie
Newbie


Joined: 28 July 2002
Location: United Kingdom
Status: Offline
Points: 33
Post Options Post Options   Thanks (0) Thanks(0)   Quote snapey Quote  Post ReplyReply Direct Link To This Post Posted: 08 January 2005 at 7:18pm
You are comparing the username "fred" with the UserID (5)
 
I'm no SQL expert, but there should be a SQL string to do this rather than walking through the recordset.
 
how about something like;
sql "SELECT UserID FROM tblusers WHERE username= '" & username & "';"
 
if this returns an empty recordset then you know that the user is unique, if not then you have the ID of the row and you can use this to update or report.
 
I always stick a line like
response.write (sql & "<br>") underneath the above so that I can see what my SQL statement ended up being. Then comment it out when its all working.
 
Also, if you response.redirect in the middle of the script you will leave the recordset object open, tying up server resources?
 
Mark
Back to Top
felix.akinyemi View Drop Down
Groupie
Groupie
Avatar

Joined: 09 December 2004
Location: United States
Status: Offline
Points: 113
Post Options Post Options   Thanks (0) Thanks(0)   Quote felix.akinyemi Quote  Post ReplyReply Direct Link To This Post Posted: 09 January 2005 at 5:19am
Originally posted by snapey snapey wrote:

You are comparing the username "fred" with the UserID (5)
 
There are both txt...
 
thanks... its cool, i got it workin!!
Back to Top
felix.akinyemi View Drop Down
Groupie
Groupie
Avatar

Joined: 09 December 2004
Location: United States
Status: Offline
Points: 113
Post Options Post Options   Thanks (0) Thanks(0)   Quote felix.akinyemi Quote  Post ReplyReply Direct Link To This Post Posted: 09 January 2005 at 1:07pm
There one more thing... i want to get information from two different columns in the same row.
 
eg.
 
i want to get the values from field1 and field2 both text and from the table info
 
im not sure on how to write the query.
 
i was trying but its not workin...
 

"SELECT info.* FROM info WHERE info.field1 = '" & string1 & "' + info.field2 = '" & string2 & "
Back to Top
dj air View Drop Down
Senior Member
Senior Member
Avatar

Joined: 05 April 2002
Location: United Kingdom
Status: Offline
Points: 3627
Post Options Post Options   Thanks (0) Thanks(0)   Quote dj air Quote  Post ReplyReply Direct Link To This Post Posted: 09 January 2005 at 1:16pm
"SELECT info.* FROM info WHERE info.field1 = '" & string1 & "' AND info.field2 = '" & string2 & "' "

that should then be ok.
Back to Top
 Post Reply Post Reply Page  <123

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.