Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用php编辑mysql表中的数据_Php_Mysql - Fatal编程技术网

使用php编辑mysql表中的数据

使用php编辑mysql表中的数据,php,mysql,Php,Mysql,我已从表中检索数据,并使用下面的代码显示它们 <?php require_once('../Connections/bidco.php'); ?> <body> <table width="671" height="43" border="1" align="center"> <table width="781" height="190" align="center"> <tr> <td height="61"

我已从表中检索数据,并使用下面的代码显示它们

<?php require_once('../Connections/bidco.php'); ?>
<body>
<table width="671" height="43" border="1" align="center">
<table width="781" height="190" align="center">
    <tr>
      <td height="61" colspan="4"><div align="center"><strong> Inventory </strong></div></td>
    </tr>
    <tr>
      <td width="77" height="68"><strong>ID</strong></td>
      <td width="152"><strong>Item name.</strong> </td>
      <td width="253"><strong>unit price</strong> </td>

      <td width="253"><strong>Update price</strong></td>

    </tr>
<?php
$query=mysql_query("SELECT *FROM manuf ") or die (mysql_error());
while($row=mysql_fetch_array($query))
{
 $id=$row['id'];
?>
 <tr>
      <td><?php echo $row['id']; ?></td>
      <td><?php echo $row['itemname']; ?></td>
    <td><?php echo $row['unitprice']; ?></td>

      <td><a href="change.php">change</a></td>


 </tr>
 <?php

}
?>
</table>
</body>
</html>

库存
ID
项目名称。
单价
更新价格
现在,这段PHP代码应该允许我编辑当我单击“更改”时显示的单个行,但它没有选择行。有什么办法解决这个问题吗

<?php require_once('../Connections/bidco.php'); ?>
<?php   

        $id = isset($_GET['id']) ? $_GET['id'] : null;


        $query=mysql_query("SELECT * FROM manuf where id='$id' ")or die(mysql_error());
        $row=mysql_fetch_array($query);

        ?>

<form action="updateprice.php" method="post" enctype="multipart/form-data">
  <table align="center">
    <tr>
   <td> <label><strong>Item Name</strong></label></td>
     <td> <input type='text' name='itemname' value=" <?php echo $row['itemname']; ?>"  />
      <input type="hidden" name="id" value="<?php echo $id; ?> " /> <br /></td>
    </tr>
    <tr>

     <td><label><strong>Unit price </strong></label></td>
  <td> <input type="text" name="unitprice" value="<?php echo $row['unitprice']; ?> " /><br /></td>
  </tr>

    <tr>
  <td> 
          <input type="reset" name="Reset" value="CANCEL" />
      <br></td>


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


您忘记将您的
id
添加到您的链接

<td><a href="change.php?id=<?php echo $row['id']?>">change</a></td>

您忘记将您的
id
添加到您的链接

<td><a href="change.php?id=<?php echo $row['id']?>">change</a></td>

您忘记将您的
id
添加到您的链接

<td><a href="change.php?id=<?php echo $row['id']?>">change</a></td>

您忘记将您的
id
添加到您的链接

<td><a href="change.php?id=<?php echo $row['id']?>">change</a></td>

我想你需要

<a href="change.php?id=$row['id']">

编辑-使用Arif_suhail_123的答案-我没有注意到您将PHP与HTML混合在一起

我认为您需要

<a href="change.php?id=$row['id']">

编辑-使用Arif_suhail_123的答案-我没有注意到您将PHP与HTML混合在一起

我认为您需要

<a href="change.php?id=$row['id']">

编辑-使用Arif_suhail_123的答案-我没有注意到您将PHP与HTML混合在一起

我认为您需要

<a href="change.php?id=$row['id']">


编辑-使用Arif_suhail_123的答案-我没有注意到您将PHP与HTML混合在一起

您需要将rowid传递给编辑链接的href


您需要将rowid传递给编辑链接的href


您需要将rowid传递给编辑链接的href


您需要将rowid传递给编辑链接的href


您正在
change.php
中查找
id
,但您没有在标题中发送它。您必须使用更改
更改

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


另外,我建议您停止使用
mysql.*
命令,因为现在和将来都不再支持。请改用
mysqli.*
命令。

您正在
change.php
中查找
id
,但您没有在标题中发送它。您必须使用更改
更改

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


另外,我建议您停止使用
mysql.*
命令,因为现在和将来都不再支持。请改用
mysqli.*
命令。

您正在
change.php
中查找
id
,但您没有在标题中发送它。您必须使用更改
更改

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


另外,我建议您停止使用
mysql.*
命令,因为现在和将来都不再支持。请改用
mysqli.*
命令。

您正在
change.php
中查找
id
,但您没有在标题中发送它。您必须使用更改
更改

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

另外,我建议您停止使用
mysql.*
命令,因为现在和将来都不再支持。改用
mysqli.*
命令。

谢谢:)我不想虚报荣誉!这样OP就能得到正确的答案。回馈恩惠。谢谢:)我不想虚报荣誉!这样OP就能得到正确的答案。回馈恩惠。谢谢:)我不想虚报荣誉!这样OP就能得到正确的答案。回馈恩惠。谢谢:)我不想虚报荣誉!这样OP就能得到正确的答案。报恩。