doujia1871 2015-10-25 19:42
浏览 33
已采纳

edit.php没有工作,没有通知/错误显示[关闭]

I have a problem with the editing data on uploaded to MySQL. I am trying to edit the name file and the descryption,but there is no data shown on the form, here my edit.php

<html>
<head>
<title>Form Edit Data</title>
</head>

<body>

<a href="homeadmin.php">Kembali</a> 

<table border=1>



<tr>
    <td align=center>Edit Data</td>
  </tr>
  <tr>
    <td>
      <table>
      <?php
      include "dbconfig.php";

      error_reporting(E_ALL); 

      $id = (int)$_GET['id'];
      $mysql = "SELECT * FROM tbl_uploads WHERE id=$id";
      $result = mysql_query($mysql);
      $row = mysql_fetch_array($result);
      echo mysql_error();
      ?>
      <form method="post" action="update.php?">
      <input type="hidden" name="id" value="<?php  echo "$row[id]"?>">
        <tr>        
          <td>Nama File</td>
          <td>
            <input type="text" name="file" 
        size="40" value="<?php echo "$row[file]"?>">
          </td>
        </tr>
        <tr>
          <td>Deskripsi</td>
          <td>
            <textarea input type="text" name="dekripsi"
            value="<?php echo "$row[dekripsi]"?>"> </textarea>
          </td>
        </tr>

        <tr>


     <td align="right">
            <input type="submit" 
          name="submit" value="Update">
          </td>
        </tr>
      </form>
      </table>
    </td>
  </tr>
</table>
</body>
</html>

i cant get the data from what i choose, its blank form, but when i try to change the query to :

$mysql = "SELECT * FROM tbl_uploads WHERE id";

it get the data in the form, but not from what i choose, from the first id on the table (i choose the 3 id from the table) this should be fill with the data from what i choose.

  • 写回答

1条回答 默认 最新

  • douqian9729 2015-10-26 05:13
    关注

    You forgot to have a href that getting the ID:
    Here is a sample code:

    <a href="edit.php?id=<?php echo $row['id']; ?>" >
    

    for your dekripsi , is this the name of the column in your table?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 vue3中融入gRPC-web
  • ¥15 kali环境运行volatility分析android内存文件,缺profile
  • ¥15 写uniapp时遇到的问题
  • ¥15 vs 2008 安装遇到问题
  • ¥15 matlab有限元法求解梁带有若干弹簧质量系统的固有频率
  • ¥15 找一个网络防御专家,外包的
  • ¥100 能不能让两张不同的图片md5值一样,(有尝)
  • ¥15 informer代码训练自己的数据集,改参数怎么改
  • ¥15 请看一下,学校实验要求,我需要具体代码
  • ¥50 pc微信3.6.0.18不能登陆 有偿解决问题