473,394 Members | 1,810 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 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 1293

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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.