Organizational Research By

Surprising Reserch Topic

php mysql stored procedures how do i get access an out value


php mysql stored procedures how do i get access an out value  using -'php,mysql,stored-procedures,mysqli'

Documentation is severely lacking on anything to do with stored procedures in mysql with PHP. I currently have a stored procedure that I call via PHP, how can I get the value of an out parameter?
    

asked Sep 14, 2015 by Krystal61Qsh
0 votes
4 views



Related Hot Questions

2 Answers

0 votes

it looks like it's answered in this post:

http://forums.mysql.com/read.php?52,198596,198717#msg-198717

With mysqli PHP API:

Assume sproc myproc( IN i int, OUT j int ):

$mysqli = new mysqli(  "HOST", "USR", "PWD", "DBNAME" );
$ivalue=1;
$res = $mysqli->multi_query( "CALL myproc($ivalue,@x);SELECT @x" );
if( $res ) {
  $results = 0;
  do {
    if ($result = $mysqli->store_result()) {
      printf( "Result #%u:
", ++$results ); while( $row = $result->fetch_row() ) { foreach( $row as $cell ) echo $cell, " "; } $result->close(); if( $mysqli->more_results() ) echo "
"; } } while( $mysqli->next_result() ); } $mysqli->close();
answered Sep 14, 2015 by UlyssesLomba
0 votes

Here's an example of how to do this with mysql, mysqli, and pdo:

http://www.joeyrivera.com/2009/using-mysql-stored-procedures-with-php-mysqlmysqlipdo/

answered Sep 14, 2015 by CheryleBadha

...