gudisa
gudisa

Reputation: 23

Not able to display image from database on webpage

I am not able to display my full image on my webpage from database my codemy image is goint to database

my database image

$con=  mysqli_connect("localhost", "root", "", "project");

        if(!$con)
       {
           die('not connected');
       }
            $result=  mysqli_query($con, "SELECT addplace, stayamount, foodamount, airlinesamount, noofdays,noofnights, 
    SUM(stayamount + foodamount + airlinesamount) AS totalamount,choose
FROM adddetails GROUP BY packageid");



?>
<div class="container">
<CENTER><h2>view packages</h2>
</CENTER>  
<table class="table table-bordered">

  <th>place</th>
  <th>stay cost</th>
  <th>food cost</th>
  <th>flight cost</th>
  <th>no of days</th>
  <th>no of nights</th>
  <th>total amount</th>
  <th>image</th>


        <?php

             while($row =mysqli_fetch_array($result))

             {
                 ?>
            <tr>
                <td><?php echo $row['addplace']; ?></td>
                <td><?php echo $row['stayamount']; ?></td>
                <td><?php echo $row['foodamount'] ;?></td>
                <td><?php echo $row['airlinesamount'] ;?></td>
                <td><?php echo $row['noofdays'] ;?></td>
                <td><?php echo $row['noofnights'] ;?></td>
                <td><?php echo $row['totalamount'] ;?></td>
              <td><?php echo '<img src=data:image/jpeg;base64,'.base64_encode( $row['choose'] ).'>'; ?></td>
            </tr>
        <?php
             }
             ?>
             </table>
            </div>
  </div>

my web page

please rewrite my code and i want my image of 150*150 size to be fitted on my web page in my table

Upvotes: 0

Views: 52

Answers (1)

Rehan
Rehan

Reputation: 4013

try using this.

<td><img src='".$row['choose']."'/></td>";

Upvotes: 1

Related Questions