mercredi 11 octobre 2017

how to sum of an stdobject value and an string value in php?

I want to get the sum of a string and array values in PHP but I have no idea how I can do this.

$class_id=$this->db->get_where('enroll' , array('student_id' => $student_id))->row()->class_id;
$class_fee=$this->db->get_where('class' , array('class_id' => $class_id))->row()->class_fee;
console.log($class_fee);
var_dump($class_fee);

$sql = "select sum(due) from payment " . (( (int)$student_id > 0) ? (" where student_id = " . (int)$student_id) : "");
$query_result = $this->db->query($sql);
$due=end($query_result->result());
var_dump((int)$due);

foreach ($due as $row) {
    echo '<option value="' . (int)$row . (int)$class_fee . '">' . (int)$row . (int)$class_fee . '</option>';
}

[i got this result class fee::string(3) "500" due:: int(1) total_amount:: 0500 But i want 500+0=500 Please Help me ]



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire