Hi,

I am trying to get an INOUT parameter from MySQl using PHP and PDO but getting:

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1414 OUT or INOUT argument 2 for routine xoompage.sp_send_password_reset is not a variable or NEW pseudo-variable in BEFORE trigger' in C:\xampp\htdocs\xoompage\password_reset.php:17 Stack trace: #0 C:\xampp\htdocs\xoompage\password_reset.php(17): PDOStatement->execute() #1 {main} thrown in C:\xampp\htdocs\xoompage\password_reset.php on line 17

here is MySQL sp:

CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_send_password_reset`(IN param_member_guid varchar(255), INOUT param_password_reset_guid varchar(255))
BEGIN
	DECLARE param_password_reset_guid varchar(255);

SET param_password_reset_guid = UUID();

UPDATE members SET password_reset_guid = param_password_reset_guid, password_reset_date = DATE(NOW()) WHERE member_guid = param_member_guid;

END

and this is the PHP:

$mysql_query = $mysql_connection->prepare("CALL sp_send_password_reset(:param_member_guid, :param_password_reset_guid)");
$mysql_query->bindParam(':param_member_guid', $_SESSION["member_guid"], PDO::PARAM_STR);
$mysql_query->bindParam(':param_password_reset_guid', $password_reset_guid, PDO::PARAM_STR|PDO::PARAM_INPUT_OUTPUT, 4000);

$mysql_query->execute();

    can anyone help please....

      Have you verified $_SESSION["member_guid"] before running the query?

        Yes I did. $_SESSION["member_guid" is set and have the correct value.

          pleazzzze...

          anyone have any idea how to fix this?

          What I am trying to get is just a simple OUT parameter using PDO!

            14 days later

            Its lovely work and much success in your business pains! significantly, the article is in reality the sweetest on this costly topic

              Write a Reply...