CodeIgniter Forums

Full Version: how to add 2 row data in mpdf
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I want to add two rowdata in one value using mpdf 
Code:
<td align="center"><h3>'. $row_dummy['remun'].'</h3></td>
<td align="center"><h3>'. $row_dummy['lum'].'</h3></td>
i try 1
Code:
<td align="center"><h3>'. <?php {$row_dummy['remun']+$row_dummy['lum']} ?> .' </h3></td>


no display
Make it into a JSON array and insert as string? I usually do that when I need to insert a bunch of data into one mysql cell...if thats what you mean..
Looking at single quotes and dots, looks like you are putting together a string for HTML, correct?

In that case this should work:
PHP Code:
$html '<td align="center"><h3>'.($row_dummy['remun']+$row_dummy['lum']).' </h3></td>'

You can also pre-calculate everything in model or controller and then just echo new $row_dummy['total'] in view, saves moving logic to view files, might be a bit tidier that way.
(10-13-2018, 02:29 AM)Pertti Wrote: [ -> ]Looking at single quotes and dots, looks like you are putting together a string for HTML, correct?

In that case this should work:
PHP Code:
$html '<td align="center"><h3>'.($row_dummy['remun']+$row_dummy['lum']).' </h3></td>'

You can also pre-calculate everything in model or controller and then just echo new $row_dummy['total'] in view, saves moving logic to view files, might be a bit tidier that way.
working perfectly. thanks ji
@kvanaraj,

Just for future reference... you could also just have the database do the adding for you and then send the resulting query to the ci view.