Hi,

I am trying to get the value of a stored procedure output parameter via
php, but keep getting this error: "Number of bind variables doesn't
match number of fields in prepared statement."  I have the latest
versions of mysql and php install.

The stored procedure is as follows:
DELIMITER $$
DROP PROCEDURE IF EXISTS `database`.`sproc_function` $$
CREATE DEFINER='[EMAIL PROTECTED] <mailto:DEFINER='[EMAIL PROTECTED]> `
PROCEDURE `sproc_function`(IN input_data VARCHAR(20), OUT output_data
VARCHAR(20))
BEGIN
SELECT myvalue FROM my_table WHERE myvalue = @input_data;
END $$



The php is as follows:
$generic="example";
$link = mysqli_connect("host", "username", "password", "database");
$stmt = mysqli_prepare($link, "CALL sproc_function(?)");
mysqli_stmt_bind_param($stmt, "s", $generic);
mysqli_stmt_execute($stmt);
mysqli_stmt_bind_result($stmt, $output_data);
mysqli_stmt_fetch($stmt);
mysqli_stmt_close($stmt);


I need to get the output $output_data without the error, "Number of bind
variables doesn't match number of fields in prepared statement".  I it
would be better to do this via PDO, but if someone had the solution via
procedural php it would be greatly appreciated.

Sincerely,
Ryan



[Non-text portions of this message have been removed]

Reply via email to