i used this code to upload images and display from database but not working correctly...



    <form action="addimages.php" method="post" enctype="multipart/form-data">
        <table border=0>
             <tr><td>Select Image: </td><td><input type="file" name="image"></td></tr>
             <tr><td>Caption: </td><td><input name="caption" type="text"></td></tr>
             <tr> <td colspan=2><input type="submit" name="Submit" value="Upload" ></td></tr>

 Photo Gallary:
<br />
<br />
    $result = mysql_query("SELECT * FROM images ORDER BY imgid");
    while($row = mysql_fetch_array($result))

    echo "<div class='img'>";
    echo "<a target='_blank' href=".$row['location'].">";
    echo "<img src=".$row['location']." width='110' height='120'>";
    echo "</a>";
    echo "<div class='desc'>".$row['caption'];
    echo "<br/>";
    echo "<a href=\"javascript:delimg('$row->imgid','$row->caption');\">Delete image</a></td>";
    echo "<form method ='POST' action='dimg.php'><input type='submit' value='delete'name='delete'></form>";
    echo "</div>";
    echo "</div>";

    echo "</table>";



        if (!isset($_FILES['image']['tmp_name'])) {
            echo "";
            $image= addslashes(file_get_contents($_FILES['image']['tmp_name']));
            $image_name= addslashes($_FILES['image']['name']);

                    move_uploaded_file($_FILES["image"]["tmp_name"],"../images/" . $_FILES["image"]["name"]);

                    $location="../images/" . $_FILES["image"]["name"];

                    $save=mysql_query("INSERT INTO images (caption, location) VALUES ('$caption','$location')");
                    header("location: gallarymanager.php");

some images are displayed and some blank image fields....

I've tried the code and its working perfectly, check the Extensions for the files you uploaded but I don't think this affect the proccess.
you could try to see the path of blank image and you'll know what is wrong.
maybe you clicked on upload without choosing a picture that will put empty record on database, you should put a condition to check if the form is empty

if (!isset($_FILES['image']['tmp_name']) || $_FILES['image']['tmp_name'] == "" ) {
    echo "Choose a picture first";

thank you for the reply...i studied my scripts as you said...now it's working.

you can mark this question as solved :)