hope everyone is fine there, i just wanted to ask that i want to display the image im storing in the database using php.. but i dont know how to display it, would i be able to retrieve it simply by echoing?? im not getting how would the whole process will go..please help..heres my code

thnx for ur time :))

 <form id="form" method="post" action="update-profile-action.php" enctype="multipart/form-data">
        <label for="Fname">First Name:</label> <input type="text" id="Fname" class="text" value="<?php echo $firstname; ?>" name="Fname" /> <br /><br />
        <label for="Lname">Last Name:</label> <input type="text" id="Lname" class="text" value="<?php echo $lastname; ?>" name="Lname" /><br /> <br />

<?php 
if ($_SESSION["type"]=="T")
{
?>        
        <label>Profile Image:</label> <input type="file" name="profileimg" value="" /><br /><br />
        <label>Qualification:</label><br />
        <textarea name="qualification" class="text" id="qualification"><?php echo $qualification;?></textarea><br /><br />
        <label>Education & Teaching History:</label><br />
        <textarea name="briefintro" class="text" id="intro"><?php echo $briefintro; ?></textarea><br /><br />
<?php
}
?>
        <input type="submit" class="mybutton" value="Update Profile" />

    </form>

and this is update-profile-action.php

<?php include("../includes/config.php");?>
<?php
$Fname=$_POST["Fname"];
$Lname=$_POST["Lname"];
$image=$_FILES["profileimg"];
$briefintro=$_POST["briefintro"];
$qualification=$_POST["qualification"];

$con=mysql_connect($dbserver,$dbusername,$dbpassword);
if (!$con) { die('Could not connect: ' . mysql_error()); }


 mysql_select_db($dbname, $con);
$query=("UPDATE accounts SET firstname='".$Fname."' , lastname='".$Lname."' ,  profileimg='".$image."' ,  briefintro='".$briefintro."',  qualification='".$qualification."' WHERE id=".$_SESSION['id']);
$result = mysql_query($query);
header("Location: update-profile.php?status=3");
mysql_close($con);
?>

Recommended Answers

All 5 Replies

You can just echo it, echo "<img src=". $image ." />";

@websponge thanx for ur response :)
i've echoed it by the same method but its not showing the image...nor giving any type of error.. please help

You first need to move the image to a permanent location. See this thread.

@pirates is it necessary to move image to a folder??? im storing the image in the database using medium blob type...i cant understand, need help

Okay, see this page in the manual about what part of $_FILES to use in your query.

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.