我正面臨着未定義的索引問題。我檢查了我的html圖像代碼,看起來不錯。在提交網站中使用undefined常量
,但它仍然顯示問題,當我嘗試更新的頁面
它的主要問題是,當我更新的頁面,
顯示它是這樣的
注意:未定義的索引:圖像中 /Applications/XAMPP/xamppfiles/htdocs/cms/admin/includes/edit_post.php 上線31
說明:Undefin ED指數:圖像中 /Applications/XAMPP/xamppfiles/htdocs/cms/admin/includes/edit_post.php 上線32
QUERY FAILED .You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '= '2', post_title = 'javascript', post_date = now(), post_author = 'Winter', pos' at line 1
所以,Im相當肯定我對這些查詢一些語法問題行,也許我忘了添加一些行的空間?
我相信函數confirm()很好,它只是一個函數名。
$query ="UPDATE posts SET";
$query .="post_category_id = '{$post_category_id}', ";
$query .="post_title = '{$post_title}', ";
$query .="post_date = now(), ";
$query .="post_author = '{$post_author}', ";
$query .="post_status = '{$post_status}', ";
$query .="post_tags = '{$post_tags}' , ";
$query .="post_content = '{$post_content}', ";
$query .="post_image ='{$post_image}' ";
$query .="WHERE post_id = {$the_post_id} ";
$update_post = mysqli_query($connection,$query);
confirm($update_post);
// if(! $update_post) // die("QUERY FAILED" . mysqli_error($connection));
這是圖像格式組HTML代碼
我籤的名字=「post_image」他們似乎比賽。
我檢查了其他人的問題,但仍不明白爲什麼有一個通知在這裏。
$query = "SELECT * FROM posts WHERE post_id = $the_post_id ";
$select_posts_by_id = mysqli_query($connection,$query);
while($row = mysqli_fetch_assoc($select_posts_by_id)){
$post_image = $row['post_image'];
}
if(isset($_POST['update_post'])){
$post_image = $_FILES['image']['name'];
$post_image_temp = $_FILES['image']['tmp_name'];
move_uploaded_file($post_image_temp, "../images/$post_image");
}
<div class="form-group">
<label for="post_image">Post Image</label>
<img width="100" src="../images/<?php echo $post_image ?>" alt="" >
<input type="file" name="post_image">
</div>