CodeIgniter Forums
how to add 2 row data in mpdf - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: General (https://forum.codeigniter.com/forumdisplay.php?fid=1)
+--- Forum: Lounge (https://forum.codeigniter.com/forumdisplay.php?fid=3)
+--- Thread: how to add 2 row data in mpdf (/showthread.php?tid=71932)



how to add 2 row data in mpdf - kvanaraj - 10-12-2018

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


RE: how to add 2 row data in mpdf - Leo - 10-12-2018

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..


RE: how to add 2 row data in mpdf - Pertti - 10-13-2018

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.


RE: how to add 2 row data in mpdf - kvanaraj - 10-13-2018

(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


RE: how to add 2 row data in mpdf - php_rocs - 10-14-2018

@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.