Welcome Guest, Not a member yet? Register   Sign In
Insert computed value into SQL database
#1

I would like to insert the following computed value 

$this->data['score_percentage'] = 0;
if ($score != 0) {
$this->data['score_percentage']=number_format(
(($score/$totalQuestions)*100),2
);
}

if (isset($useroptions) && count($useroptions)>0) {
$userid = $this->session->userdata('user_id');
unset($where);
unset($records);
$data['userid'] = $userid;
$data['email'] = $this->session->userdata('email');
$data['username'] = $this->session->userdata('username');
$data['quiz_id'] = $quizinfo->quizid;
$data['score'] = $score;
$data['total_questions'] = $totalQuestions;
$data['dateoftest'] = date('y-m-d');
$data['timeoftest'] = date('H:i');

into the the attached table format

Attached Files Thumbnail(s)
   
Reply


Messages In This Thread
Insert computed value into SQL database - by cndunga - 01-02-2017, 04:51 AM



Theme © iAndrew 2016 - Forum software by © MyBB