dongliang1654 2017-03-12 21:55
浏览 65

使用存储过程更新数据库时出错

This is my php code below

$token = md5(uniqid(rand(), true));
        $complete = 'No';
        $update_sql = "CALL updatetoken ('$db_email','$token','$complete')";
        echo $update_sql;
        // $update_sql = "UPDATE user SET resetToken = {$token}, resetCompleted='No' WHERE email = {$_POST['email']}";
        $sqlfile = mysqli_query($connection, $update_sql);

        if ($sqlfile) {
            echo "Update successful";

        } else {
            echo "Error updating the database";
        }

Then the stored procedure

CREATE DEFINER=`root`@`localhost` PROCEDURE `updatetoken` (IN `usermail` VARCHAR(100), IN `token` VARCHAR(100), IN `completetask` VARCHAR(100))  UPDATE user SET resetToken = token, resetCompleted = completetask WHERE email = usermail$$

IMAGE FOR STORE PROCEDURE

instead of updating the database, i keep getting error message "Error updating the database", I tried using the normal "INSERT" mysql method from my php code instead of CALL, but still same error message

  • 写回答

2条回答 默认 最新

  • dongxing7318 2017-03-19 00:57
    关注

    A semicolon (;) is missing at the end of update sentence:

    enter image description here

    评论

报告相同问题?

悬赏问题

  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 MATLAB中streamslice问题
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 51单片机中C语言怎么做到下面类似的功能的函数(相关搜索:c语言)
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序