You can not store images in Database.
First You need to create a new folder in your site root to store images.Then save the image name in Database and to display the image use the file name from DB
example:
define('GW_UPLOADPATH', 'images/');
fileName = $_FILES['userfile']['name'];
$tmpName = $_FILES['userfile']['tmp_name'];
$fileSize = $_FILES['userfile']['size'];
$fileType = $_FILES['userfile']['type'];
$target = GW_UPLOADPATH . $tmpName;
move_uploaded_file($_FILES['userfile']['tmp_name'], $target
$conn = mysql_connect("localhost", "root", "");
mysql_select_db("test", $conn);
$query = "INSERT INTO pics VALUES ('','$fileName', '$fileType', '$fileSize')";
mysql_query($query, $conn) or die('Error, query failed');
echo "<br>File $fileName uploaded<br>";
}
?>