megavan Posted April 25, 2007 Share Posted April 25, 2007 I'm getting the error "Truncated incorrect DOUBLE value: '14, 14, 14, 14'saveckasgn.asp, line 12" on trying to open the asp file mentioned in the error. I'm using mysql as the backend and am not sure whether the culprit is that or asp. kindly help! Link to comment Share on other sites More sharing options...
justsomeguy Posted April 25, 2007 Share Posted April 25, 2007 Post the code that is causing the error. The error is being issued by the database, but it could be due to something happening in ASP. Link to comment Share on other sites More sharing options...
megavan Posted April 26, 2007 Author Share Posted April 26, 2007 Surely <!--#include file="config.asp" --><%session("myProfid")=session("myProfid")prname = Request("prname")studid=Request.form("studid") asid=Request.form("asid") grade=Request.form("grade") remark=Request.form("remark") call opendbsql="update ass_status set grade='" & grade & "',remark='" & remark & "' where ass_id='" & asid & "' and student_id='" & studid & "';"sql1="update ass_status set status='checked' where ass_id='" & asid & "' and student_id='" & studid & "';"objConn.execute(sql)objConn.execute(sql1)response.redirect("ckasgn.asp")%> Link to comment Share on other sites More sharing options...
justsomeguy Posted April 26, 2007 Share Posted April 26, 2007 Hmm.. something weird is going on, one of the variables you are inserting might be coming from something like checkboxes or a multiple select list where it is getting multiple values. Write out the query to see what is being sent to the database:Response.Write(sql)objConn.execute(sql) Link to comment Share on other sites More sharing options...
megavan Posted April 26, 2007 Author Share Posted April 26, 2007 Here's the table I'm trying to update:CREATE TABLE `ass_status` ( `Ass_Id` int(11) NOT NULL, `Student_Id` int(11) default NULL, `Status` varchar(20) default NULL, `Grade` varchar(20) default NULL, PRIMARY KEY (`Ass_Id`)) ENGINE=InnoDB DEFAULT CHARSET=latin1;And the value for the 'Grade' variable is indeed coming from a drop down menu. Also noticed this on the error page:POST Data:studid=1&asid=15&studid=1&asid=15&studid=1&asid=15&studid=1&asid=15&studid=1&asid=15&studid=1&asid=15&grade=A Link to comment Share on other sites More sharing options...
pulpfiction Posted April 26, 2007 Share Posted April 26, 2007 The problem is with the post data. it sends the same studid and asid multiple times.... so when you form the query it will be like this..update ass_status set grade='A',remark='' where ass_id='15, 15, 15, 15, 15, 15' and student_id='1, 1, 1, 1, 1, 1';Grade seems to be fine.This is obviously wrong... Can you post the code of the previous page which redirects to this asp page.. Link to comment Share on other sites More sharing options...
megavan Posted April 26, 2007 Author Share Posted April 26, 2007 Code for the previous page <%prname = Request("prname")%>WELCOME <% response.write(prname) & "," %></b></div><br><table border=1 name=dt width=100%><form name=doubtsec method=post action=saveckasgn.asp> <%session("myProfid")=session("myProfid")studid=request.querystring("studid")asid=request.querystring("asid")'response.write asid'response.write studidSet rec3 = Server.CreateObject("ADODB.Recordset") Set rec1 = Server.CreateObject("ADODB.Recordset")call opendbsql="select * from answer where ass_id='" & asid & "' and student_id='" & studid & "';"rec3.open sql,objConnif rec3.eof thenresponse.write("<br><b>NO ASSIGNMENTS</b>")elserec3.movefirst do qsno=rec3("student_id") answ=rec3("answer") qsno=rec3("question_no") sql1="select question from questions where ass_id='" & asid & "' and question_no='" & qsno & "';" rec1.open sql1,objConn if rec1.eof then response.write("<br><b>NO Question</b>") else qs=rec1("question") response.write("<input type=hidden name=studid value='" & studid & "'>") response.write("<input type=hidden name=asid value='" & asid & "'>") response.write("<tr><td>" & qsno & "</td><td>" & qs & "</td></tr>") response.write("<tr><td colspan=2>" & answ & "</td></tr><tr></tr>") end if rec1.close rec3.movenext loop until rec3.EOFend if%></tr></td><tr><td><font color="red">Remark :<td><textarea rows=9 cols=20 name="remark"></textarea><tr><td align=center><select name="grade"> <option name=grade value=A>A</option> <option name=grade value=B>B</option> <option name=grade value=C>C</option> <option name=grade value=D>D</option> <option name=grade value=LATEMARK>LATE MARK</option></select> </td><td align=center><input type=submit value=submit></td></tr></td></tr></form></table> There's a bit more before this but that's just general html page layout code Link to comment Share on other sites More sharing options...
justsomeguy Posted April 26, 2007 Share Posted April 26, 2007 These two lines:response.write("<input type=hidden name=studid value='" & studid & "'>")response.write("<input type=hidden name=asid value='" & asid & "'>")are in a loop. That means that they will be printed out once for every record. That is why they are being sent in a list, because you have then being printed 5 times or something. Remove them from the loop, either print them before or after it, but not in the loop. Link to comment Share on other sites More sharing options...
megavan Posted April 27, 2007 Author Share Posted April 27, 2007 Did what you said above and it seems to be working now. Thanks a lot for that.And what do those 2 lines really do? (i'm not the one who did the code) Link to comment Share on other sites More sharing options...
pulpfiction Posted April 27, 2007 Share Posted April 27, 2007 Those 2 statements [hidden textbox] are written to put the student id and asid. if that statement is in the loop then it results in multiple hidden textboxes of the same name and value. If you see the POST data, there are multiple studif and asid. since we require these values only once, you need to write the code outside the loop.... Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.