SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Nov 2013
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    why getting: argument for routine is not a variable in MySQL routine?!

    Hi,

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

    HTML Code:
    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:

    HTML Code:
    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:


    PHP Code:
    $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_guidPDO::PARAM_STR|PDO::PARAM_INPUT_OUTPUT4000); 

    $mysql_query->execute(); 

  2. #2
    SitePoint Evangelist
    Join Date
    Aug 2006
    Location
    Nantwich, Cheshire
    Posts
    410
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Have a search around for Mysql Error 1414 - it seems (though I am not familiar enough with mysql to properly understand what's going on) that this is a bug in some versions of Mysql.
    http://www.firenza.net - my homage to a car from the 1970s


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •