How to Use output return values when php calls a stored procedure through pdo
Create procedure 'para _ out' (out id int) begin select 5 into id; SELECT id; END $ stmt = $ dbh-> prepare ("CALL para_out (?) "); $ Stmt-> bindParam (1, $ return_value, PDO: PARAM_INT, 8); // call the stored procedureif ($ stmt-> execute () = false) print_r ($ stmt-> errorInfo (); else print "procedure returned $ return_value \ n "; // returns Array ([0] => 42000 [1] => 1414 [2] => OUT or INOUT argument 1 for routine test. para_out is not a variable or NEW pseudo-variable in BEFORE trigger)
Reply to discussion (solution)
$ Stmt-> bindParam (1, $ return_value, PDO: PARAMINT | PDO: PARAM_INPUT_OUTPUT, 8 );
$ Stmt-> bindParam (1, $ return_value, PDO: PARAMINT | PDO: PARAM_INPUT_OUTPUT, 8 );
Same errors,
Your stored procedure does not declare the input parameter. how can I CALL para_out (?) What about it?
Your stored procedure does not declare the input parameter. how can I CALL para_out (?) What about it?
Ask how to write it and let it return 5. thank you,
You can get 10 points for every day.
Alas, no one answered ~~~~
People,
Waiting for answers
$ Stmt = $ dbh-> prepare ("CALL para_out (?) ");
Change
$ Stmt = $ dbh-> prepare ("CALL para_out (@?) ");
Try