472,354 Members | 1,543 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,354 software developers and data experts.

These Numbers are seen as Alpha...

25
I am trying to make a quiz script but am not good at asp scripting. For example I couldn't pass a parameter as a number. But it is seen as a alphanumerical character. When I try to ad 5 to 14 it must be 19 but It results 514. The values coming from access database. The parameter's name is toplampuan (total point). Can you solve my problem?

sorugel.asp
[PHP]<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1254">
<title>Quiz</title>
</head>
<body>
<%
Set vt = Server.CreateObject("ADODB.Connection")
vt.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("test.mdb")

set rs = server.createobject("ADODB.Recordset")

sorusira=request.form("sorusira")
if sorusira="" then
sorusira=1
end if


select case sorusira
case 1
sql = "select * from tbl_CoktanSecmeliSorular where fld_Puani between 0 AND 10 "
case 2
sql = "select * from tbl_CoktanSecmeliSorular where fld_Puani between 11 AND 20 "
case 3
sql = "select * from tbl_CoktanSecmeliSorular where fld_Puani between 21 AND 30 "
case 4
sql = "select * from tbl_CoktanSecmeliSorular where fld_Puani between 31 AND 40 "
case 5
sql = "select * from tbl_CoktanSecmeliSorular where fld_Puani between 41 AND 50 "
case 6
sql = "select * from tbl_CoktanSecmeliSorular where fld_Puani between 51 AND 60 "
case 7
sql = "select * from tbl_CoktanSecmeliSorular where fld_Puani between 61 AND 70 "
case 8
sql = "select * from tbl_CoktanSecmeliSorular where fld_Puani between 71 AND 80 "
case 9
sql = "select * from tbl_CoktanSecmeliSorular where fld_Puani between 81 AND 90 "
case 10
sql = "select * from tbl_CoktanSecmeliSorular where fld_Puani between 91 AND 100 "
case 11
sql = "select * from tbl_CoktanSecmeliSorular where fld_Puani between 101 AND 110 "
case 12
sql = "select * from tbl_CoktanSecmeliSorular where fld_Puani between 111 AND 120 "
case 13
sql = "select * from tbl_CoktanSecmeliSorular where fld_Puani between 121 AND 130 "
case 14
sql = "select * from tbl_CoktanSecmeliSorular where fld_Puani between 131 AND 140 "
case 15
sql = "select * from tbl_CoktanSecmeliSorular where fld_Puani between 141 AND 150 "
end select

rs.open sql,vt,1,3

Function ReOrderArrayQuickNDirty(ByVal aArray)
Dim iUpper, iLower, iLoop, iSwapPos, varTmp
iUpper = UBound(aArray)
iLower = LBound(aArray)
Randomize Timer
For iLoop = iLower to iUpper
iSwapPos = Int(Rnd * (iUpper + 1))
varTmp = aArray(iLoop)
aArray(iLoop) = aArray(iSwapPos)
aArray(iSwapPos) = varTmp
Next
ReOrderArrayQuickNDirty = aArray
End Function

Randomize
rastgele = Int((Rnd*Rs.RecordCount)+0)
Rs.Move(rastgele)

soru=Rs("fld_Soru")
cevap1=Rs("fld_Secenek1")
cevap2=Rs("fld_Secenek2")
cevap3=Rs("fld_Secenek3")
cevap4=Rs("fld_Secenek4")
cevap=Rs("fld_DogruSecenek")
puan=Rs("fld_Puani")


toplampuan=request.form("toplampuan")


Dim secenekler
ReDim secenekler(3)

secenekler(0) = "1;"& cevap1
secenekler(1) = "2;"& cevap2
secenekler(2) = "3;"& cevap3
secenekler(3) = "4;"& cevap4
%>
<table border="0" width="100%" id="table1">
<tr>
<td width="240">
<table border="0" width="100%" id="table2">
<tr>
<td width="87">Kullanıcı</td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="87">Soru No</td>
<td><%=sorusira%></td>
</tr>
<tr>
<td width="87">Soru Puanı</td>
<td><%=Rs("fld_Puani")%></td>
</tr>
<tr>
<td width="87">Doğru Sayısı</td>
<td><%=Rs("fld_DogruSayisi")%></td>
</tr>
<tr>
<td width="87">Yanlış Sayısı</td>
<td><%=Rs("fld_YanlisSayisi")%></td>
</tr>
<tr>
<td width="87">Toplam Puan</td>
<td><%=toplampuan%></td>
</tr>
<tr>
<td width="87">&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
<p>&nbsp;</td>
<td>
<%



response.write soru
response.write "<br /><br /><br />"

Dim iLoop
%>

<form method="POST" action="kontrol.asp">

<%
aSites = ReOrderArrayQuickNDirty(secenekler)
For iLoop = LBound(aSites) to UBound(aSites)
array1 = split(aSites(iLoop),";")
Response.Write "<input type=""radio"" id=""" & array1(0) & """ sec name=""cevap" & SoruNo & """ value=""" & array1(0) & """ /><label for=""" & array1(0) & """>" & array1(1) & "</label><BR>"

Next
%>
<input type="hidden" name="dogrucevap" value="<%=cevap%>">
<input type="hidden" name="sorusira" value="<%=sorusira%>">
<input type="hidden" name="toplampuan" value="<%=toplampuan%>">
<input type="hidden" name="puan" value="<%=puan%>">

<%
rs.Close
set rs = nothing
%> <p><input type="submit" value="Gönder" name="B1"></p>
</form>
</td>
</tr>
</table>
</body>
</html>[/PHP]


kontrol.asp

[PHP]<%
dim toplampuan, sorusira
sorusira=request.form("sorusira")
sorusira=sorusira+1

%>
<head>
<meta http-equiv="Content-Language" content="tr">
</head>
<body>
<center>
<%
verilencevap=request.form ("cevap")
dogrucevap=request.form ("dogrucevap")
dogrucevapmetni=request.form ("dogrucevapmetni")
toplampuan=request.form ("toplampuan")
puan=request.form ("puan")

if verilencevap=dogrucevap then
response.write "<br>Tebrikler Doğru Cevap. <br><img src=""resimler/dogrucevap.jpg"">"

if toplampuan="" then
toplampuan=puan
else
toplampuan=toplampuan + puan
end if

else
response.write "<br>Yanlış Cevap Verdiniz.<br><img src=""resimler/yanliscevap.jpg"">"
end if
%>

<form method="POST" action="sorugel.asp">
<p><input type="submit" value="Sonraki Soru" name="B1"></p>
<input type="hidden" name="sorusira" value="<%=sorusira%>">
<input type="hidden" name="toplampuan" value="<%=toplampuan%>">

</form>

</center>

</body>

</html>[/PHP]
Sep 12 '06 #1
0 1271

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Ivo | last post by:
Hi, An array contains elements of the form , for example IVa, XIXb, LIX and LXIVc. Does anyone have a function which can sort this array in a way a human would expect it to, with the roman letters...
4
by: sdd | last post by:
I am whacking away at some code to view numbers as bit sequences. While this is not complete, I'd appreciate some feedback from anyone who is interested in looking at it:...
30
by: rh0dium | last post by:
Hi All, While I know there is a zillion ways to do this.. What is the most efficient ( in terms of lines of code ) do simply do this. a=1, b=2, c=3 ... z=26 Now if we really want some...
10
by: Tuvas | last post by:
I've been thinking about writing a program to generate the world's largest prime numbers, just for the fun of it. This would require being able to hold an 8000000 digit number into memory (25...
3
by: Stewart Allen | last post by:
Hi there I'm trying to find part serial numbers between 2 numbers. The user selects a part number from a combo box and then enters a range of serial numbers into 2 text boxes and the resulting...
89
by: purifier | last post by:
The problem is to write a program in 'C' to find the greatest of 2 given numbers... Easy? huh here's the catch do not use 'if' or any conditional statements if u want it to be a little more...
33
by: patrick_woflian | last post by:
hey guys, im just writing a basic calculation at the moment, before building on it for an A-Level piece of work. i can add/divide etc... two numbers together yet i am having a major problem with...
4
by: gps | last post by:
I'm trying to use Dmax to dip into a my invoice header table and pull the maxium invoice number out of it. I'm running Access 2007 on Vista Business, but had the same prob with Access 2003 on...
2
by: dpreston74 | last post by:
Hello forum. I need to learn how write a SQL script to strip 0s from data and strip alpha letters from alpha numeric data. e.g. I get data like 054, 006, 903, for a dept number. I need to...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
1
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. header("Location:".$urlback); Is this the right layout the...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.