doudang2817 2017-04-07 10:03
浏览 23
已采纳

我的PHP表单中没有在数据库中执行编辑和删除[重复]

This question already has an answer here:

spcmaoscnja sc sa'dl vas dv;kas kjas dk s d kfjsdf;k sd;kjf ojd aojsd ajs d; as cc ;kjajs d; kas

</div>
  • 写回答

1条回答 默认 最新

  • dory4404 2017-04-07 10:34
    关注

    You have used mysql_connect() in the update clause of the code. If your PHP version is 7 and above it will not work (will work for 5.5 and 5.6 versions but with a warning) as it is deprecated.

    Warning

    This extension was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0. Instead, the MySQLi or PDO_MySQL extension should be used. See also MySQL: choosing an API guide and related FAQ for more information. Alternatives to this function include:

    mysqli_connect()
    PDO::__construct()
    

    Read more here.

    I don't see the point in establishing a new connection while editing when there is a database connection that was made in the beginning of the script. Use the same functions used to insert data to the database from your script:

    $db->query("UPDATE tablename SET column_name = value");
    // to check no. of rows affected by the previous query 
    $db->affected_rows()
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 连续两帧图像高速减法
  • ¥15 组策略中的计算机配置策略无法下发
  • ¥15 如何绘制动力学系统的相图
  • ¥15 对接wps接口实现获取元数据
  • ¥20 给自己本科IT专业毕业的妹m找个实习工作
  • ¥15 用友U8:向一个无法连接的网络尝试了一个套接字操作,如何解决?
  • ¥30 我的代码按理说完成了模型的搭建、训练、验证测试等工作(标签-网络|关键词-变化检测)
  • ¥50 mac mini外接显示器 画质字体模糊
  • ¥15 TLS1.2协议通信解密
  • ¥40 图书信息管理系统程序编写