Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 help in code i made...
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

CooLGiL
Junior Member

126 Posts

Posted - 02 March 2002 :  11:26:56  Show Profile  Send CooLGiL an ICQ Message
here is the code plz tell me wht wrong in it its suppose to show wht you need to the at the time:
<%

dim realtime,timea,timeb,timec,timed
realtime=time
timea=timevalue("07:00")
timeb=timevalue("07:45")
timec=timevalue("14:30")
timed=timevalue("20:00")
timee=timevalue("23:00")
y=""
if realtime<timea then
y="get up now to get ready for school!!"
else
y=""
end if

if rimea<timeb then
y="go to school"
else
y=""
end if

if timeb<timec then
y="make your homework"
else
y=""
end if

if timec<timed then
y="get a shower"
else
y=""
end if
if timed<timee then
y="go to sleep"
else
y=""
end if
%>
<%=y%>

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 02 March 2002 :  11:39:25  Show Profile
Hey Cool ... it's because in each of your if...then...else statements you are essentially resetting y back to "". Also, you use < for each so if the time is 05:00, what do you really want it to say? Get up and go to school or keep sleeping? Do something like this instead:

select case realtime
case timea
y = "get up now to get ready for school!"
case timeb
y = "go to school"
.
. and so on
.
case else
y = ""
end select


I'll leave it up to you to figure out how to make sure you include the times in between timea, timeb, timec, etc!!

Edit - I didn't read it very closely the first time...you also have if statements that compare constants that you've set: if timea < timeb ... you're not comparing the realtime to the constants that you've set.

Nikkol

Edited by - Nikkol on 02 March 2002 11:43:47
Go to Top of Page

CooLGiL
Junior Member

126 Posts

Posted - 02 March 2002 :  12:08:32  Show Profile  Send CooLGiL an ICQ Message
here is the code tell me whts wrong he writting nada:
<%

dim realtime,timea,timeb,timec,timed,y
realtime=time
timea=timevalue("07:00")
timeb=timevalue("07:45")
timec=timevalue("14:30")
timed=timevalue("20:00")
timee=timevalue("23:00")


select case realtime

case timea

y = "get up now to get ready for school!"

case timeb

y = "go to school"

case timec

y = "make homework"

case timed

y = "get a shower"

case timee

y = "go to sleep"

end select
%>
<%=y%>

Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 02 March 2002 :  12:17:00  Show Profile
It's not writing anything because chances are the realtime isn't equal to any of your constants (timea, timeb, etc.). Try playing around with something like this:

case >= timea and < timeb
y = "get up and go to school"
case >= timeb and < timec
y = "go to school"
case >= timec and < timed
y = "do your homework"


Scratch that ... it won't work ... it would be easier to use elseif:

if realtime >= timea and realtime < timeb then
y = "get up and go to school"
else if realtime >= timeb and realtime < timec then
y = "do your homework"


and so on...

Nikkol

Edited by - Nikkol on 02 March 2002 12:27:29
Go to Top of Page

CooLGiL
Junior Member

126 Posts

Posted - 02 March 2002 :  12:21:12  Show Profile  Send CooLGiL an ICQ Message
man! i cant ardenstand plz write me the full code! i worked on my code like hour and i didnt accomplish it plz make it for me! sow i will able to learn out of my mastakes

#######

you are leading me to no where.....

Edited by - coolgil on 02 March 2002 12:24:23
Go to Top of Page

CooLGiL
Junior Member

126 Posts

Posted - 02 March 2002 :  12:32:09  Show Profile  Send CooLGiL an ICQ Message
quote:

It's not writing anything because chances are the realtime isn't equal to any of your constants (timea, timeb, etc.). Try playing around with something like this:

case >= timea and < timeb
y = "get up and go to school"
case >= timeb and < timec
y = "go to school"
case >= timec and < timed
y = "do your homework"


Scratch that ... it won't work ... it would be easier to use elseif:

if realtime >= timea and realtime < timeb then
y = "get up and go to school"
else if realtime >= timeb and realtime < timec then
y = "do your homework"


and so on...

Nikkol

Edited by - Nikkol on 02 March 2002 12:27:29


man! i dont really god in asp! plz make it for me! plz it important for my school! i have a work a big work and i need to invate a proudact i told my teacher and she agree! i have no time i need to write the work plz plz plz make it for me!! i will be greatefull

Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 02 March 2002 :  12:34:29  Show Profile
Sorry for not being clear...trying to save typing ... here:

<%
dim realtime,timea,timeb,timec,timed,y
realtime=time
timea=timevalue("07:00")
timeb=timevalue("07:45")
timec=timevalue("14:30")
timed=timevalue("20:00")
timee=timevalue("23:00")

if realtime >= timea and realtime < timeb then
y = "get up now to get ready for school!"
elseif realtime >= timeb and realtime < timec then
y = "go to school"
elseif realtime >= timec and realtime < timed then
y = "make homework"
elseif realtime >= timed and realtime < timee then
y = "get a shower"
elseif realtime >= timee then
y = "go to sleep"
else
y = "error"
end if
%>

<%=y%>


Nikkol
Go to Top of Page

CooLGiL
Junior Member

126 Posts

Posted - 02 March 2002 :  12:36:25  Show Profile  Send CooLGiL an ICQ Message
thanks!!

Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 02 March 2002 :  12:38:36  Show Profile
No problem, BUT being a former teacher, I really shouldn't have done that for you ....next time I'm gonna make you think harder!!

Nikkol
Go to Top of Page

CooLGiL
Junior Member

126 Posts

Posted - 02 March 2002 :  12:39:41  Show Profile  Send CooLGiL an ICQ Message
ok! thanks

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.35 seconds. Powered By: Snitz Forums 2000 Version 3.4.07