Help with input with , and . php with myslq

Asked

Viewed 36 times

-1

I need the ACA and AIA field to return values with. or commas, the code saved in the data bank correctly but only shows the integer without comma. It is also rounding.

inserir a descrição da imagem aqui

Code:

<?php
                $count = 1;
                $marks_of_students = $this->db->get_where('mark' , array(
                    'class_id' => $class_id,
                        'section_id' => $section_id ,
                            'year' => $running_year,
                                'subject_id' => $subject_id,
                                    'exam_id' => $exam_id
                ))->result_array();
                foreach($marks_of_students as $row):
            ?>
                <tr>
                    <td><?php echo $count++;?></td>
                    <td>
                        <?php echo $this->db->get_where('student', array('student_id'=>$row['student_id']))->row()->student_code;?>
                    </td>
                    <td>
                        <?php echo $this->db->get_where('student' , array('student_id' => $row['student_id']))->row()->name;?>
                    </td>
                    <td>
                        <?php $status = $this->db->get_where('student', array('student_id' => $row['student_id']))->row()->status; ?>
                        <input <?php if($status != '1' || $statusExam == 0) { echo 'disabled'; } ?> type="text" class="form-control" name="marks_obtained_<?php echo $row['mark_id'];?>"
                            value="<?php echo $row['mark_obtained'];?>">
                    </td>
  • Doesn’t make much sense unless your column is integer in the database. It should be double

1 answer

1


To save values with dot in DB the column has to be like FLOAT and it only understands point. Comma no. It is possible that your current column is of the type INT. if you are changing to FLOAT.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.