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()
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 孟德尔随机化结果不一致
  • ¥15 深度学习残差模块模型
  • ¥50 怎么判断同步时序逻辑电路和异步时序逻辑电路
  • ¥15 差动电流二次谐波的含量Matlab计算
  • ¥15 Can/caned 总线错误问题,错误显示控制器要发1,结果总线检测到0
  • ¥15 C#如何调用串口数据
  • ¥15 MATLAB与单片机串口通信
  • ¥15 L76k模块的GPS的使用
  • ¥15 请帮我看一看数电项目如何设计
  • ¥23 (标签-bug|关键词-密码错误加密)