I am trying to show 2 images in a row .Curruntly when an image is displayed then the next image goes to a new row .what i want is that when 2 images are displayed in a row only then it should go to the next row .
for($i = 0; $i < $counter; $i++)
{
$path = "http://verfix.com/playground_app/assets/images/upload/".$data['inspection'][$i]->image;
$toolcopy .= '<tr style"height:350px;">
<td style="width:100px;">
P-'.$data['inspection'][$i]->id.'
</td>
<td style="width:420px;">
<img src="'.$path.'" width="420" height="220">
</td>
</tr>';
}
$toolcopy .= '</table>[![enter image description here][1]][1]
Thank You for any help .
Try with this code, it should do the trick.
$toolcopy = '<table>';
for($i = 0; $i < $counter; $i++)
{
$path = "http://verfix.com/playground_app/assets/images/upload/".$data['inspection'][$i]->image;
if($i === 0 || $i % 2 === 0) {
if($i > 0) $toolcopy .= '</tr>';
$toolcopy .= '<tr style"height:350px;">';
}
$toolcopy .= '
<td style="width:100px;">
P-'.$data['inspection'][$i]->id.'
</td>
<td style="width:420px;">
<img src="'.$path.'" width="420" height="220">
</td>';
}
$toolcopy .= '</tr>';
$toolcopy .= '</table>';[![enter image description here][1]][1]
It places two images in two separate TD elements in the same TR, the next two images on the next row and so on.