php - 可以用 php 将我的文本表单更新为 mysql

标签 php mysql

我想通过 php 更新文本,我可以查询 sql 中的实际文本存储并显示在输入框中,当我尝试更新时没有任何更改, 我将变量放入 echo 中,看看它是否有效,我可以在确认页面上读取新文本,但我的数据库仍然没有任何变化,我尝试直接在 mysql 上更新,它可以工作 这是我的代码

enter code here
<?php
include "../storescripts/connect_to_mysql.php"; 
// Parse the form data and add inventory item to the system
if (isset($_POST['thisID'])) {
    $id = $_POST['thisID'];
 $name = 'names';
$textes = $_POST['textes'];
// See if that product name is an identical match to another product in the system
$sql = mysql_query("UPDATE library SET name='$name',textes='$textes'WHERE   id='$id");                                                  
echo ''.$id.' New text is online, cliquer <a href="inventory_list.php">ici</a>.';

 exit();

 }
 ?>
 and my form
  <form action="text_edit.php" enctype="multipart/form-data" name="myForm" id="myform"      method="post">
    <table width="90%" border="0" cellspacing="0" cellpadding="6">
     <tr>
    <td width="20%" align="right">Title</td>
    <td width="80%"><label>
      <input name="name" type="text" id="name" size="64" value="<?php echo $name; ?>"  />
    </label></td>
    </tr>    
    </form>
</td>
    </tr>
    <?php echo ''.$targetID.' ';?>
    <tr>
    <td align="right">Text</td>
    <td><label>
      <textarea name="textes" id="textes" cols="64" rows="5"><?php echo $textes; ?>       </textarea>
    </label></td>
  </tr>
  <tr>

    <td>&nbsp;</td>
    <td ><label>
      <input name="thisID" type="hidden" value="<?php echo $targetID; ?>" />
      <input type="submit" name="button" id="btnsaveedit" value="Save Changes" />
    </label>&nbsp;          

最佳答案

$sql = mysql_query("UPDATE library SET name='$name',textes='$textes'WHERE   id='$id");

已安装

$sql = mysql_query("更新库 SET name='$name', textes='$textes' WHERE id=$id ");

关于php - 可以用 php 将我的文本表单更新为 mysql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17849320/

相关文章:

php - 如何在 ng-repeat 中使用 ng-class 为每个迭代 div 设置类

php - 显示同一 div 内表中的所有相等值

php - fetch() 方法出错

php - SQL 查询返回意外的 NULL 值

php - PDO 事务是否涵盖 PDO::query()?

MYSQL:删除某个日期的记录

python - LiveServerTestCase 服务器看到不同的数据库进行测试

php - 如何导出/导入 utf8-general-ci 数据库?

php - 问题在mysql中存储具有相同名字的多个订单

php - MySQL:无法使用 WHERE 子句返回 POINT 类型