html - Image not shown in table in PHP from mysql -
i'm doing small site product descriptions users, pictures essential making choice of product. it's run xamm-server, php , mysql. database running smoothly , php gets data database. in database, there paths images. have 3 different paths in database, 1 image, 1 root , 1 linking image on web. end getting blank instead of image. , if @ sourcecode page looks fine. going wrong?
php code:
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <?php $con=mysqli_connect("localhost","root","","headsets"); // check connection if (mysqli_connect_errno()) { echo "failed connect mysql: " . mysqli_connect_error(); } ?> <head> <link rel="stylesheet" href="styles.css"> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>lync</title> </head> <body> <div class="container"> <div class="sidebar1"> <ul class="nav"> <li><a href="index.html">forside</a></li> <li><a href="lync.html">lync/skype headsets</a></li> <li><a href="mobil.html">mobil headsets</a></li> <li><a href="ip.html">ip headsets</a></li> <li><a href="tilbehoer.html">tilbehør</a></li> <li><a href="http://mitit.ccta.dk">gå til mit it</a> </li> </ul> <!-- end .sidebar1 --></div> <div class="content"> <?php $sql = "select id, producent, model, kategori modeller"; $result = mysqli_query($con,"select * `modeller"); echo "<table>"; while($row = $result->fetch_assoc()) { echo "<tr>"; echo "<td>";?> <img scr="<?php echo $row["billedurl"]; ?>"/> <?php echo "</td>"; echo "<td>" .$row["producent"] .$row["model"]; echo "</td>"; echo "</tr>"; } echo "</table>"; mysqli_close($con); ?> <!-- end .content --></div> <!-- end .container --></div> <div class="footer"><br> <!-- end .footer --></div> </body> </html>
source code:
<div class="content"> <table><tr><td><img scr="headset.ccta.dk/pic/l_jabra_evolve80.jpg"/> </td><td>jabraevolve 80 duo </td></tr> <tr><td><img scr="skat-logo.gif"/> </td><td>jabrapro 9470</td></tr> <tr><td><img scr="http://www.jabra.dk/-/media/images/products/jabra%20motion/jabra_motion_01.png"/> </td><td>plantronicsvoyager legend b825-m</td></tr> <tr><td><img scr="-"/> </td><td>testtest2</td></tr></table> <!-- end .content --></div>
you have got 2 issues here, typo in src , lack of protocol:
<img scr="headset.ccta.dk/pic/l_jabra_evolve80.jpg"/>
it must be:
<img src="http://headset.ccta.dk/pic/l_jabra_evolve80.jpg"/>
edit:
same goes other img tags.
Comments
Post a Comment