Since, you didn't described your question properly or didn't provided any code.
So, i assumed your question in my way and posted my answer.
Follow the step.
1) For Uploading Image
<form method='POST' action='UploadImage.php' enctype="multipart/form-data">
<input type='file' name='UploadImage'>
<input type='submit' value="submit">
</form>
Suppose your Project Folder Name Is : MyProject (Where all project files are present),
Make one folder inside "MyProject" Folder namely "MyUploadImages"
Now,
UploadImage.php
<?php
include('connect.php'); // Do Database Connection in this file (create a file namely connect.php inside MyProject Folder)
extract($_POST);
$UploadedFileName=$_FILES['UploadImage']['name'];
if($UploadedFileName!='')
{
$upload_directory = "MyUploadImages/"; //This is the folder which you created just now
$TargetPath=time().$UploadedFileName;
if(move_uploaded_file($_FILES['files']['tmp_name'], $upload_directory.$TargetPath)){
$QueryInsertFile="INSERT INTO TableName SET ImageColumnName='$TargetPath'";
// Write Mysql Query Here to insert this $QueryInsertFile .
}
}
?>
Now, In your Database Table, you can find ImageColumnName that image path is set as MyUploadImages/1417Flower.jpg
2) Retreiving Image from database
AnyPage.php
<?
$Query="SELECT * FROM TableName";
// Write mysql query to fetch $Query
store that ImageColumnName value to any variable say $MyPhoto.
?>
<img src="<?echo $MyPhoto;?>">