M
montiy
Copied below is some code that I've written for a page of mine, and it's not
working. Could someone please take a look and suggest what I might be doing
wrong? I'm very much a beginner at code-writing, so please keep your replies
on a beginner's level...Thanks!
I'm trying to accomplish the following:
1) The web page pulls three fields from a database into which the user is
entering data. (I've put validation forms on the entry form to be sure that
the user is entering minutes as an integer between greater than zero, seconds
as an integer between 0 and 59, and hundredths as an integer between 0 and
99.)
2) The three variables (Minutes50FreeBoys, Seconds50FreeBoys, and
Hundredths50FreeBoys) are assigned to the three database field values.
3) I want the results (when displayed in a table column that I've created)
to be displayed like such: "1:03.05" (for minutes, seconds, and hundredths of
a second). THUS...I need to be sure that the "seconds" field and the
"hundredths" field are both displayed as TWO DIGITS. So, I've tried to use
if/then statements to change any single-digits numbers (0 through 9) to
double-digits ("00", "01", "02", etc).
4) Then I want the result to display in the following format:
Minutes:Seconds.Hundredths (ex: 2:05.73)
Printed here is my current code. I'm GUESSING that I'm going wrong
somewhere in the handling of my variables (maybe in the if/then statements
where I'm changing a number to a text value?). I'd appreciate any help that
you're able to give...Thanks!
-- Nate
---------------------------
<%
Minutes50FreeBoys=FPFieldVal(fp_rs,"Minutes_Freestyle50yd")
Seconds50FreeBoys=FP_FieldVal(fp_rs,"Seconds_Freestyle50yd")
Hundredths50FreeBoys=FP_FieldVal(fp_rs,"Hundredths_Freestyle50yd")
If Seconds50FreeBoys=0 Then Seconds50FreeBoys="00"
If Seconds50FreeBoys=1 Then Seconds50FreeBoys="01"
If Seconds50FreeBoys=2 Then Seconds50FreeBoys="02"
If Seconds50FreeBoys=3 Then Seconds50FreeBoys="03"
If Seconds50FreeBoys=4 Then Seconds50FreeBoys="04"
If Seconds50FreeBoys=5 Then Seconds50FreeBoys="05"
If Seconds50FreeBoys=6 Then Seconds50FreeBoys="06"
If Seconds50FreeBoys=7 Then Seconds50FreeBoys="07"
If Seconds50FreeBoys=8 Then Seconds50FreeBoys="08"
If Seconds50FreeBoys=9 Then Seconds50FreeBoys="09"
If Hundredths50FreeBoys=0 Then Hundredths50FreeBoys="00"
If Hundredths50FreeBoys=1 Then Hundredths50FreeBoys="01"
If Hundredths50FreeBoys=2 Then Hundredths50FreeBoys="02"
If Hundredths50FreeBoys=3 Then Hundredths50FreeBoys="03"
If Hundredths50FreeBoys=4 Then Hundredths50FreeBoys="04"
If Hundredths50FreeBoys=5 Then Hundredths50FreeBoys="05"
If Hundredths50FreeBoys=6 Then Hundredths50FreeBoys="06"
If Hundredths50FreeBoys=7 Then Hundredths50FreeBoys="07"
If Hundredths50FreeBoys=8 Then Hundredths50FreeBoys="08"
If Hundredths50FreeBoys=9 Then Hundredths50FreeBoys="09"
%>
<%
=Minutes50FreeBoys & ":" Seconds50FreeBoys & "." & Hundredths50FreeBoys
%>
working. Could someone please take a look and suggest what I might be doing
wrong? I'm very much a beginner at code-writing, so please keep your replies
on a beginner's level...Thanks!
I'm trying to accomplish the following:
1) The web page pulls three fields from a database into which the user is
entering data. (I've put validation forms on the entry form to be sure that
the user is entering minutes as an integer between greater than zero, seconds
as an integer between 0 and 59, and hundredths as an integer between 0 and
99.)
2) The three variables (Minutes50FreeBoys, Seconds50FreeBoys, and
Hundredths50FreeBoys) are assigned to the three database field values.
3) I want the results (when displayed in a table column that I've created)
to be displayed like such: "1:03.05" (for minutes, seconds, and hundredths of
a second). THUS...I need to be sure that the "seconds" field and the
"hundredths" field are both displayed as TWO DIGITS. So, I've tried to use
if/then statements to change any single-digits numbers (0 through 9) to
double-digits ("00", "01", "02", etc).
4) Then I want the result to display in the following format:
Minutes:Seconds.Hundredths (ex: 2:05.73)
Printed here is my current code. I'm GUESSING that I'm going wrong
somewhere in the handling of my variables (maybe in the if/then statements
where I'm changing a number to a text value?). I'd appreciate any help that
you're able to give...Thanks!
-- Nate
---------------------------
<%
Minutes50FreeBoys=FPFieldVal(fp_rs,"Minutes_Freestyle50yd")
Seconds50FreeBoys=FP_FieldVal(fp_rs,"Seconds_Freestyle50yd")
Hundredths50FreeBoys=FP_FieldVal(fp_rs,"Hundredths_Freestyle50yd")
If Seconds50FreeBoys=0 Then Seconds50FreeBoys="00"
If Seconds50FreeBoys=1 Then Seconds50FreeBoys="01"
If Seconds50FreeBoys=2 Then Seconds50FreeBoys="02"
If Seconds50FreeBoys=3 Then Seconds50FreeBoys="03"
If Seconds50FreeBoys=4 Then Seconds50FreeBoys="04"
If Seconds50FreeBoys=5 Then Seconds50FreeBoys="05"
If Seconds50FreeBoys=6 Then Seconds50FreeBoys="06"
If Seconds50FreeBoys=7 Then Seconds50FreeBoys="07"
If Seconds50FreeBoys=8 Then Seconds50FreeBoys="08"
If Seconds50FreeBoys=9 Then Seconds50FreeBoys="09"
If Hundredths50FreeBoys=0 Then Hundredths50FreeBoys="00"
If Hundredths50FreeBoys=1 Then Hundredths50FreeBoys="01"
If Hundredths50FreeBoys=2 Then Hundredths50FreeBoys="02"
If Hundredths50FreeBoys=3 Then Hundredths50FreeBoys="03"
If Hundredths50FreeBoys=4 Then Hundredths50FreeBoys="04"
If Hundredths50FreeBoys=5 Then Hundredths50FreeBoys="05"
If Hundredths50FreeBoys=6 Then Hundredths50FreeBoys="06"
If Hundredths50FreeBoys=7 Then Hundredths50FreeBoys="07"
If Hundredths50FreeBoys=8 Then Hundredths50FreeBoys="08"
If Hundredths50FreeBoys=9 Then Hundredths50FreeBoys="09"
%>
<%
=Minutes50FreeBoys & ":" Seconds50FreeBoys & "." & Hundredths50FreeBoys
%>