Jump to content

vikiesakki

New Members
  • Posts

    2
  • Joined

  • Last visited

vikiesakki's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 1 or -0.25 is the actual value of 'n'. My problem is 5days its working normal but now its not working. i don't know what could be the problem.
  2. I have online examination portal, in which a user selects an answer and clicks next. At this point I make an AJAX call. With each AJAX call I insert one row into the database. I'm storing marks as floats. It should store either 1 or -0.25, but sometimes it stores 0, and I can't find the problem. Here is my code: Jquery Code: var questin = $("#ques"+next).val(); var secin = $("#sect"+next).val(); $.ajax({ data:{ques:questin,answ:n,sec:secin}, method:'post', async:false, url:'result.php', success:function(data){ } }); PHP Code: <?php include("action/db.php"); session_start(); $ques_id = $_REQUEST['ques']; $mark = (float) $_REQUEST['answ']; $sec = $_REQUEST['sec']; $exam_date_id = $_SESSION['ex_da']; $use_id = $_SESSION['uid']; $run->db_open(); $query2 = mysql_query("SELECT * FROM useranswers WHERE question_id='$ques_id' AND user_id='$use_id'"); $no = mysql_num_rows($query2); if($no==0){ $date = date("Y:m:d:h:m:s"); $query1 = mysql_query("INSERT INTO useranswers VALUES ('','$exam_date_id','$use_id','$ques_id',0,'$sec','$mark','0','0','$date')"); }else{ $query1 = mysql_query("UPDATE useranswers SET mark='$mark' WHERE question_id='$ques_id'"); } $run->db_close(); ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.