jarenjarfa
jarenjarfa

Reputation: 3

I can't show the picture

Here is my source code.


<?php
include "koneksi.php";
$datatamu=  mysql_query("select judul_gambar,nama_file from gambar order by judul_gambar asc");
echo "
    <table>
        <tr>
            <th>judul_gambar</th>
            <th>gambar</th>
        </tr>";
        while($rec=mysql_fetch_object($datatamu)){

        echo "<tr>";
        echo "<td>".$rec->judul_gambar."</td>";
        echo "<td";
        echo "<img src='.$rec->nama_file.' alt='.$rec->judul_gambar' title='.$rec->judul_gambar' width='100'>";
        echo "</td>";
        echo "</tr>";
        }"
    </table>";
        mysql_close();
?>

I'm creating a folder gambar on the same directory with the source code. and here is the database


id_gambar:Int[5]


judul_gambar:varchar[25]


nama_file:varchar[25]


sorry if my english bad. :)

Upvotes: 0

Views: 41

Answers (1)

Mark Baker
Mark Baker

Reputation: 212412

In the echo statement, using . for concatenation when you're not concatenating means the . will appear in the echoed output

echo "<img src='".$rec->nama_file."' alt='".$rec->judul_gambar."' title='".$rec->judul_gambar."' width='100'>";

Upvotes: 2

Related Questions