mysql - is there a way to display image from database using $result->fetch_row in php? -


hello i'm newbie in php , i'm working in project right now. use mysql database , i'm using object oriented style of coding. problem don't have idea of how display image using object oriented style.. here codes:

<?php $sql2="select id, name, item_price, item_size, item_color, picture, category, type item "; $result2 = $conn->query($sql2);  if ($result2) {     while ($row = $result2->fetch_row()) {         ?>           <tr>             <td><?= $row[0]?></td>             <td><?= $row[1]?></td>             <td><?= $row[2]?></td>             <td><?= $row[3]?></td>             <td><?= $row[4]?></td>             <td><img src="data:image/png;base64,<?= $row[5]?>" alt="" /></td>             <td><?= $row[6]?></td>             <td><?= $row[7]?></td>         </tr>         <?php     } } ?> 

all column able display data except image not working or not displaying image. idea appreciated.. i'm sorry english..

do not store images in database.

example reference: can store images in mysql

save images in somewhere on public server , save paths them in database (then, should use varchar types of columns in table).

after that, can use data (as mentioned in comments):

<img src="your_base_path/<?php echo $row[5] ?>" alt="<?php echo $altdesc ?>" /> 

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -