mysql - PHP MySQLi Photo single page -
i have made photo gallery, shows photos mysqli database, when click on link on each photo, must go single page shows photo.
index.php
$query = mysqli_query($conn, "select * images"); while($row = mysqli_fetch_array($query)) { $id = $row['id']; $image = $row['image']; echo "<td><a href='single.php?id=$id'><img src='$image'></a></td>"; }
single.php
$id = $row['id']; $query = mysqli_query($conn, "select * images id='$id'"); <?php while($row = mysqli_fetch_array($query)) { $image = $row['image']; echo "<img src='$image'>"; }
single.php change first line to
$id = intval($_get['id']);
Comments
Post a Comment