更新記錄我上傳一些數據到包含標題,新聞日期和圖像的數據庫,但是當我想更新它我面臨的問題。基本上我想要做什麼我更新除圖像以外的所有行,然後更新不會發生。我基本上想要什麼時候我需要更新讓我們假設標題只有它應該更新它,但所有其他數據應該保持相同,但問題是,我不得不從我的電腦再次選擇圖像更新。我的情況是,我只保存在數據庫的名稱不整的路徑和硬編碼在以往任何時候我需要顯示的圖像圖像應保持不變更在php
這裏是HTML的路徑
<div class="row">
<label>Image upload</label>
<div class="right"><input type="file" name="file" value="<?php echo $row['images'];?>" /></div>
</div>
這裏是php
if(($_GET['mod']=='edit') && (isset($_POST['hidden'])))
{
echo $_FILES["file"]["name"];
$allowedExts = array("jpg", "jpeg", "gif", "png");
$extension = end(explode(".", $images));
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/png")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& in_array($extension, $allowedExts))
{
if ($_FILES["file"]["error"] > 0)
{
echo $_FILES["file"]["error"] . "<br>";
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"], "upload-images/" . $images);
$update="UPDATE headline SET
headline_title = '$title',
headline_des = '$description',
month = '$month_name',
day = '$day_name',
year = '$year_name',
featured = '$featured',
headline = '$headline',
images = '$images'
where id = ".$_GET['id']."";
$result = mysql_query($update);
}
}
想要分享一些片段來解釋你在做什麼和如何做? – ksg91
我編輯的問題在提交更新用IMGE – user1885057