关于使用PHP的mysql中的存储过程,文档严重缺乏.我目前有一个通过PHP调用的存储过程,如何获取out参数的值?
它似乎在这篇文章中回答:
http://forums.mysql.com/read.php?52,198596,198717#msg-198717
使用mysqli PHP API:
假设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();
这是一个如何使用mysql,mysqli和pdo执行此操作的示例:
http://www.joeyrivera.com/2009/using-mysql-stored-procedures-with-php-mysqlmysqlipdo/