doujiang1939 2014-11-27 22:07
浏览 6

使用“编辑”按钮编辑/更新mysql表

Ive made this blog and I need a little help, this is the index.php where the posts are being printed, same with their images...

<?php
if (!isset($_SESSION['name'])) {
}else{

echo "<a href=\"edit.php?id=".$image."\"><strong>EDIT</strong>";
}
?>

and here is edit.php

 <?php
 $_GET['id']
 $sql = mysql_query("SELECT * FROM BlogData id");
$row = mysql_fetch_array($sql){
$title = $row['title'];
$content = $row['content'];
$category = $row['category'];
$image = $row['id'];
$extension= $row['ext'];

 ?>

 <center>
 <form action='edit.php' method='post' enctype="multipart/form-data">
    Title: <input type='text' name='title' placeholder="$title" /><br>
    Date: <input type='text' name='category' placeholder="$category" /><br>
 <textarea rows="10" cols="50" name='content'>$content</textarea><br>
    <?php 
echo "<img width='228' height='60' src='uploads/".$image.".".$extension."'>";
  ?>
Select image to upload:
     <input type="file" name="fileToUpload" id="fileToUpload">
 <br><br><br>
     <input type="submit" value="edit!" name="submit">
 </form>
 <img src="images/tutorialpost2.jpg">
 </center>

 ?>

So I've got this EDIT button and I want it to work. It should be able to edit all my MySQL table with the current ID. how do I do it?

  • 写回答

1条回答 默认 最新

  • dongxu4023 2014-11-27 22:24
    关注
    if (isset($_SESSION['name'])) {
      <button>
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退