error while calling stored procedure from php
Posted: Thu Jun 25, 2009 3:35 am
Hi guys,im calling a simple stored procedure from php passing parameter for table name,but its not working showing nothing,
stored procedure:
php code:
can anyone help me ??
Thanks in advance
stored procedure:
Code: Select all
DROP PROCEDURE `p1`//
CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`(IN `strTable` VARCHAR(50))
SELECT * FROM strTable
Code: Select all
<?
$mysqli = new mysqli( "localhost", "root", "", "test2" );
$vTableName="student";
$res = $mysqli->multi_query( "CALL p1($vTableName);" );
if( $res )
{
echo "if";
$j=0;
if ($result = $mysqli->store_result()) {
while( $row = $result->fetch_row() ) {
echo "
";
foreach( $row as $cell )
{
echo $cell. "<===|====>";
++$j;
}
echo "
";
}
$result->close();
}
}
$mysqli->close();
?>
Thanks in advance