1

I want to show an image in table cell from database. But this code doesn't work

    <tbody>
            <?php
            $i=1;
            foreach($item_list as $item){
                ?>
                <tr>
                <td><?=$i++; ?></td>
                    <td><img src="<?= $item->image;?>" alt="Not found"></td>
                </tr>
             <?php } ?>
   </tbody>
bcperth
  • 2,191
  • 1
  • 10
  • 16

1 Answers1

0

Simply add Base_url() to the img . and give some width and height if you like.

<tbody>
            <?php
            $i=1;
            foreach($item_list as $item){
                ?>
                <tr>
                <td><?=$i++; ?></td>
                   <td><img src="<?=base_url().$item->image;?>" alt="Image Not Found" width="100" heigth="100"></td>
                </tr>
             <?php } ?>
   </tbody>
Syed Waqas Ahmad
  • 134
  • 1
  • 14