Gossamer Forum
Home : Products : Gossamer Links : Discussions :

something wrong with code

Quote Reply
something wrong with code
I'm using the following code to display age groups according to the User's age.

<%if age lt '10'%>age group 5-9
<%elsif age gt '8' and lt '13'%>age group 10-12
<%elsif age gt '11' and lt '19'%>age group 13-18
<%endif%>

For some reason it will not display the correct age groups.

Can anyone help with what I am doing wrong?

Thanks
Quote Reply
Re: [Alba] something wrong with code In reply to
Try this

<%if age gt '4' and lt '10'%>age group 5-9
<%elsif age gt '4' and lt '13'%>age group 10-12
<%elsif age gt '4' and lt '19'%>age group 13-18
<%endif%>

Hope that helps,
Chris
RGB World, Inc. - Software &amp; Web Development.
rgbworld.com
Quote Reply
Re: [Alba] something wrong with code In reply to
Hi,

Any reason you're not using >= <= etc?

Something lie this should work;

Code:
<%if age < 10%>
age group 5-9
<%elsif age > 8 and age < 13%>
age group 10-12
<%elsif age > 11 and age < 19%>
age group 13-18
<%endif%>

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] something wrong with code In reply to
Thanks folks, I've used Andy's solution.
Quote:
Any reason you're not using >= <= etc?

Only because my previous experience with trying to do this was in DBSQL where it would not work. Have now changed over to using it.

Thanks