Avatar billede jnissen Nybegynder
16. maj 2005 - 15:56 Der er 4 kommentarer og
1 løsning

Hvordan får jeg tidspunktet sat på?

Hejsa

Jeg sidder og roder lidt med noget statistik til min side, men har fået et problem.

Jeg bruger denne kode til at se hvornår folk besøger siden:

--
Set Rs00 = ConnS.Execute("SELECT COUNT(*) AS FOUND FROM statistik Where Cstr(tid) LIKE '00%';" )
Set Rs01 = ConnS.Execute("SELECT COUNT(*) AS FOUND FROM statistik Where Cstr(tid) LIKE '01%';" )
Set Rs02 = ConnS.Execute("SELECT COUNT(*) AS FOUND FROM statistik Where Cstr(tid) LIKE '02%';" )
Set Rs03 = ConnS.Execute("SELECT COUNT(*) AS FOUND FROM statistik Where Cstr(tid) LIKE '03%';" )
Set Rs04 = ConnS.Execute("SELECT COUNT(*) AS FOUND FROM statistik Where Cstr(tid) LIKE '04%';" )
Set Rs05 = ConnS.Execute("SELECT COUNT(*) AS FOUND FROM statistik Where Cstr(tid) LIKE '05%';" )
Set Rs06 = ConnS.Execute("SELECT COUNT(*) AS FOUND FROM statistik Where Cstr(tid) LIKE '06%';" )
Set Rs07 = ConnS.Execute("SELECT COUNT(*) AS FOUND FROM statistik Where Cstr(tid) LIKE '07%';" )
Set Rs08 = ConnS.Execute("SELECT COUNT(*) AS FOUND FROM statistik Where Cstr(tid) LIKE '08%';" )
Set Rs09 = ConnS.Execute("SELECT COUNT(*) AS FOUND FROM statistik Where Cstr(tid) LIKE '09%';" )
Set Rs10 = ConnS.Execute("SELECT COUNT(*) AS FOUND FROM statistik Where Cstr(tid) LIKE '10%';" )
Set Rs11 = ConnS.Execute("SELECT COUNT(*) AS FOUND FROM statistik Where Cstr(tid) LIKE '11%';" )
Set Rs12 = ConnS.Execute("SELECT COUNT(*) AS FOUND FROM statistik Where Cstr(tid) LIKE '12%';" )
Set Rs13 = ConnS.Execute("SELECT COUNT(*) AS FOUND FROM statistik Where Cstr(tid) LIKE '13%';" )
Set Rs14 = ConnS.Execute("SELECT COUNT(*) AS FOUND FROM statistik Where Cstr(tid) LIKE '14%';" )
Set Rs15 = ConnS.Execute("SELECT COUNT(*) AS FOUND FROM statistik Where Cstr(tid) LIKE '15%';" )
Set Rs16 = ConnS.Execute("SELECT COUNT(*) AS FOUND FROM statistik Where Cstr(tid) LIKE '16%';" )
Set Rs17 = ConnS.Execute("SELECT COUNT(*) AS FOUND FROM statistik Where Cstr(tid) LIKE '17%';" )
Set Rs18 = ConnS.Execute("SELECT COUNT(*) AS FOUND FROM statistik Where Cstr(tid) LIKE '18%';" )
Set Rs19 = ConnS.Execute("SELECT COUNT(*) AS FOUND FROM statistik Where Cstr(tid) LIKE '19%';" )
Set Rs20 = ConnS.Execute("SELECT COUNT(*) AS FOUND FROM statistik Where Cstr(tid) LIKE '20%';" )
Set Rs21 = ConnS.Execute("SELECT COUNT(*) AS FOUND FROM statistik Where Cstr(tid) LIKE '21%';" )
Set Rs22 = ConnS.Execute("SELECT COUNT(*) AS FOUND FROM statistik Where Cstr(tid) LIKE '22%';" )
Set Rs23 = ConnS.Execute("SELECT COUNT(*) AS FOUND FROM statistik Where Cstr(tid) LIKE '23%';" )

Dim MyArraytid (24)
MyArraytid(0) = Rs00("FOUND")
MyArraytid(1) = Rs01("FOUND")
MyArraytid(2) = Rs02("FOUND")
MyArraytid(3) = Rs03("FOUND")
MyArraytid(4) = Rs04("FOUND")
MyArraytid(5) = Rs05("FOUND")
MyArraytid(6) = Rs06("FOUND")
MyArraytid(7) = Rs07("FOUND")
MyArraytid(8) = Rs08("FOUND")
MyArraytid(9) = Rs09("FOUND")
MyArraytid(10) = Rs10("FOUND")
MyArraytid(11) = Rs11("FOUND")
MyArraytid(12) = Rs12("FOUND")
MyArraytid(13) = Rs13("FOUND")
MyArraytid(14) = Rs14("FOUND")
MyArraytid(14) = Rs15("FOUND")
MyArraytid(16) = Rs16("FOUND")
MyArraytid(17) = Rs17("FOUND")
MyArraytid(18) = Rs18("FOUND")
MyArraytid(19) = Rs19("FOUND")
MyArraytid(20) = Rs20("FOUND")
MyArraytid(21) = Rs21("FOUND")
MyArraytid(22) = Rs22("FOUND")
MyArraytid(23) = Rs23("FOUND")

for i = 0 to 23
alle_tal = alle_tal + MyArraytid(i)
next
%>
--
<%
for i = 0 to 23
%>
<table>
<tr>
<td width="80"><b>----her vil jeg have tidspunktet stående-----:</b>></td>
<td><% temp = CInt((MyArraytid(i)/alle_tal)*100)%><img border="0" src="streg.jpg" width="<%response.write temp*10%>" height="10"><%=temp%>% ( <%= MyArraytid(i) %> )</td>
</tr>
</table>
<%
next
%>

Men jeg kan ikke få den til at skrive tidspunktet ud for hver graf. Det skal altså være sådan at den fx skriver "kl. 22-23" ud for en post som hedder "22" i databasen.

Hvordan går jeg det?
Avatar billede winman Nybegynder
16. maj 2005 - 17:46 #1
<%
Function TwoChar(Expression)
if len(Expression) = 1 then AddZero = "0"
TwoChar = AddZero & Expression
end function

for i = 0 to 23
%>
<table>
<tr>
<td width="80"><b><%= TwoChar(i)%> - <%= TwoChar(i + 1)%>:</b>></td>
<td><% temp = CInt((MyArraytid(i)/alle_tal)*100)%><img border="0" src="streg.jpg" width="<%response.write temp*10%>" height="10"><%=temp%>% ( <%= MyArraytid(i) %> )</td>
</tr>
</table>
<%
next
%>
Avatar billede winman Nybegynder
16. maj 2005 - 17:48 #2
og hvis du ikke vil have den til at skrive 23 - 24 ud for posten 23 fra databasen..
Skal du jo bare sige i funktionen TwoChar sådan her:

Function TwoChar(Expression)
if len(Expression) = 1 then AddZero = "0"
TwoChar = AddZero & Expression
if Expression = 24 then TwoChar = "00"
end function
Avatar billede jnissen Nybegynder
16. maj 2005 - 18:57 #3
Du bare sku bare en guttermand. Mange tak for hjælpen. Det er lige sådan jeg ville have det.

Smider du lige et svar, så du kan få dine point.
Avatar billede winman Nybegynder
17. maj 2005 - 08:42 #4
Jamen det var så lidt... god fornøjelse....
Avatar billede jnissen Nybegynder
17. maj 2005 - 17:28 #5
Tak :-)
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester