Store a image in database. and fetch the image when the user login

You could do that, but why don't you just save the image on the server, and save a link to it in the database, which you can use to display the image? :)

Oh, and what is it that you are asking, exactly?

Thanks for you reply
What exactly i need is i want store the image in database and that image will be display when i login to my account.

I would suggest to keep filepath in database and upload that file in file system of server.

commented: same +4

What do you have so far?

I am beginer of php.
Now only i have learned inserting deleting and implemented in my website now i need to insert image,,

I am beginer of php.
Now only i have learned inserting deleting and implemented in my website now i need to insert image,,

What is your logic behind wanting to store the image within the database system instead of the regular file system? It's not that it's impossible (or even difficult), but that we want to ensure you're doing it for the right reasons. You've said it yourself: you're new to PHP. Help us help you by answering our questions.

make datatype in database as BLOB. and then store file on this. you can use this.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head></head>
<body>

<?php
    $username=$_REQUEST['Name'];
    $image = file_get_contents($_FILES['image']['tmp_name']);
     $image = addslashes($image);
   // $conn=mysql_connect("localhost","root","******") or die('Error');
   // mysql_select_db("oracle",$conn) or die('Error');
    include "consam.php";
    $sql="INSERT INTO sample1 (Name,image)//image attribute in DB is blob type.
            VALUES ('$username','$image')";
    mysql_query($sql,$conn);
    mysql_close($conn);

?>
    <form method="post" action="test1.php" enctype="multipart/form-data">
    Username :<input type="text" name="Name"/><br>
    Upload Image :<input type="file" name="image" id="file"><br>
    <input type="submit" value="Submit"/>
     </form>

</body>
</html>

I have this code but it not working

Thanks Bob Hensley Sir
My logic i want create student and staff biodata form and storetheir detail in database. For the bio date i want insert their profile picture in their biodata

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.