Hi Guys,
I got a problem with updating images in mysql database wih php form.
It succesfully inserted the images into the database, but it can't do any updates/changes on the existing image record.

Thanks


PHP Code:
<?
session_start();
include("database.php");
include("login.php");
$pro_id = $_POST['pro_id'];
$pro_name = $_POST['pro_name'];
$pro_cat = $_POST['pro_cat'];
$pro_desc = $_POST['pro_desc'];
$pro_price = $_POST['pro_price'];

if (isset($_POST['edit']))
{
        $name = $_FILES['myfile']['name'];
        $tmp_name = $_FILES['myfile']['tmp_name'];

    if($name)
        {    
            $location = "image/$name";
            move_uploaded_file($tmp_name, $location);
            $sql = "UPDATE product SET pro_name ='$pro_name', pro_cat ='$pro_cat', pro_desc ='$pro_desc', pro_price ='$pro_price', location ='$location' WHERE pro_id ='$pro_id'";
            $result = mysql_query($sql);
            echo "<br>Product has been Edited.<br><br><br>";
            die();
        }
}               

$sql = mysql_query("SELECT * FROM product where user_id = '$_SESSION[user_id]'and pro_cat = '$pro_cat' ORDER  by pro_id ASC")or die(mysql_error());
while($row = mysql_fetch_array($sql))
{
$location = $row[imagelocation];
    ?>
            bla...bla...bla....bla
            bla...bla...bla....bla
            
            <td>
            <? echo"<img src='$location' width ='250' height='250'>"                             
            </td>            
                            
            <TD>Image:</TD>
            <TD><input name='myfile' type='file'></TD>
            </TR><br>     

            <input type='hidden' name='pro_id' maxlength='60' value = '<?php echo $row['pro_id']; ?>'>
            <tr><td colspan='2' align='right'>
            <input type='submit' name='edit' value='Edit Product'>
            </td></tr>
            </table>
            </form>
    <?
}
?>