php - How to retrieve only one desired image from a folder in database using its name? -
we have saved lots of images in uploads folder in root folder. want display single image each user profile.
the name of image stored in database table user
in field profile_image
. using name need retrieve same name image uploads folder.
<?php $filename=mysql_query("select profile_image user username='$user_check'"); ?> <div id="photo"> <?php echo "<img src='uploads/".$filename."' class='img'/>"; ?> </div>
$result = $mysqli->query("select profile_image user username='$user_check'" limit 1"); while ($row = mysqli_fetch_assoc($result)){ $filename=$row['profile_image']; } <div id="photo"> <?php echo "<img src='uploads/".$filename."' class='img'/>"; ?> </div>
you can utilize mysql , not mysqli if want
php html mysql
No comments:
Post a Comment