• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to add 2 row data in mpdf

#1
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
Reply

#2
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..
Wait, what?
Reply

#3
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.
Reply

#4
(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
Reply

#5
@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.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.