Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Get an age
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Get an age

 Post Reply Post Reply
Author
aero View Drop Down
Groupie
Groupie
Avatar

Joined: 21 May 2003
Location: Denmark
Status: Offline
Points: 80
Post Options Post Options   Thanks (0) Thanks(0)   Quote aero Quote  Post ReplyReply Direct Link To This Post Topic: Get an age
    Posted: 02 June 2003 at 3:05pm

Hi I have this SGL code and it vil show all peble that have an age between 10 and 14 !!

SELECT * FROM db WHERE (age>=10) and (age<=14)

But if i want a function so an user can decide what *agetype he want to see, how can I then make the kode so it show that age I want to see !???

*AGETYPE

10 - 14 Years
15 - 19 Years
20 - 24 Years
25 - 29 Years
30 - 34 Years
35 - 39 Years
and so on !!!!!

Pleas help me !!!

Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 02 June 2003 at 3:55pm

Pass it from a form where you have the formvalue passed of e.g. a radio box like
<select name="agerange" value="10 AND 14" type="radio"> and so on then generate the SQL Query in the form:
agerange = Request("agerange")
sql="Select * from db where age between " & agerange

Just add however many radio buttons or if you want a dropdown. This code only work for one value at a time so no multiple....

Back to Top
aero View Drop Down
Groupie
Groupie
Avatar

Joined: 21 May 2003
Location: Denmark
Status: Offline
Points: 80
Post Options Post Options   Thanks (0) Thanks(0)   Quote aero Quote  Post ReplyReply Direct Link To This Post Posted: 02 June 2003 at 4:15pm

Okay great !!!

But if I want it to show the persons between 10 and 14 and then have the agerange function !!  how is the code then look like !??

Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 02 June 2003 at 7:28pm

Well if you want to show 10-14 by default and then selectable for other ranges you would do something like...
If agerange = "" THEN

   sql = "Select * from db where age between 10 AND 14"

ELSE

   sql ="Select * from db where age between " & agerange

END IF

'Do you displaying here

....

below all that or wherever you just put the form posting to itself 

Back to Top
aero View Drop Down
Groupie
Groupie
Avatar

Joined: 21 May 2003
Location: Denmark
Status: Offline
Points: 80
Post Options Post Options   Thanks (0) Thanks(0)   Quote aero Quote  Post ReplyReply Direct Link To This Post Posted: 03 June 2003 at 1:03pm

Michael

THX !! but I can get it to work !!

Will U pleas give me a full working script !??

My database !!
db.mdb
age
AID : Auto and Key
Name : Text
Age : Number

Will U make a working script to these informations !??? Pleas !!

Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 03 June 2003 at 1:07pm
Sorry pal, you gotta start yourself and tell us where you get stuck, I basically wrote most of the code already, you just need to extend it. Add all the db code etc and you are done. If you don't know how, there are good tutorials on this site.
Back to Top
aero View Drop Down
Groupie
Groupie
Avatar

Joined: 21 May 2003
Location: Denmark
Status: Offline
Points: 80
Post Options Post Options   Thanks (0) Thanks(0)   Quote aero Quote  Post ReplyReply Direct Link To This Post Posted: 03 June 2003 at 2:11pm

okay cant write <select name="agerange" value="10 AND 14" type="radio">  shut there be a

<form>
<select name="agerange" value="10 AND 14" type="radio">
</form>

or !?????

Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 04 June 2003 at 8:58am
of course you need to put that into a form. put all the radios in there post it to itself to display required data.
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.