RE: Regarding calling stored procedures

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 

Hi

 

try this one

 

 

<?php
$mysqli = mysqli_connect
("localhost", "root", "abcd", "empdb");
$res_new=array();
$Query1="";$Query="";$result1=0;
$url="sciencedaily.com";
$Query1="call GetExpert_last('$url')";
echo $Query1;
echo "<br/>";
$res = $mysqli->query("$Query1");
if(mysqli_num_rows($res)>0)
{
$row = mysqli_fetch_row($res);
$res = $row[0];
$res_new[] = $row[0];
$res_new[] = $row[1];

}
$mysqli->close();
$res=NULL;
*********

$mysqli = mysqli_connect
("localhost", "root", "abcd", "empdb");

$Query="call GetExpert_lastvalue($res)";
echo $Query;echo "<br/>";
$result1=5;
$result1=$mysqli->query("$Query");
echo "hai";echo "<br/>";
echo $result1;
if(mysqli_num_rows($result1)>0)
{
$expert_value= mysqli_fetch_row($result1);
$res_new[]=$expert_value[0];
$res_new[]=$expert_value[1]; 

$res_new[]=$expert_value[2]; 

} else
{
$res_new[]="None"; 
}
}

for($i=0;$i<count($res_new);$i++)
{
$strid= $res_new["$i"];
echo $strid; 
echo "<br/>";
}


?>

 

 

Thanks,

Muthukumar Selvarasu,

Project Manager (Web Development),

Webmaster Ltd.



  _____  

From: php-objects@xxxxxxxxxxxxxxx [mailto:php-objects@xxxxxxxxxxxxxxx] On
Behalf Of nanna_govind_vsp
Sent: Tuesday, December 11, 2007 9:41 PM
To: php-objects@xxxxxxxxxxxxxxx
Subject:  Regarding calling stored procedures

 

Hi All,

We are working on php and mysql database.We actually implemented 
stored procedures in the php.

Here is sample example we created.

<?php
$mysqli = mysqli_connect
("localhost", "root", "abcd", "empdb");
$res_new=array();
$Query1="";$Query="";$result1=0;
$url="sciencedaily.com";
$Query1="call GetExpert_last('$url')";
echo $Query1;
echo "<br/>";
$res = $mysqli->query("$Query1");
if(mysqli_num_rows($res)>0)
{
$row = mysqli_fetch_row($res);
$res = $row[0];
$res_new[] = $row[0];
$res_new[] = $row[1];
//$mysqli->close();
//$res=NULL;
*********$Query="call GetExpert_lastvalue($res)";
echo $Query;echo "<br/>";
$result1=5;
$result1=$mysqli->query("$Query");
echo "hai";echo "<br/>";
echo $result1;
if(mysqli_num_rows($result1)>0)
{
$expert_value= mysqli_fetch_row($result1);
$res_new[]=$expert_value[0];
$res_new[]=$expert_value[1]; 

$res_new[]=$expert_value[2]; 

} else
{
$res_new[]="None"; 
}
}

for($i=0;$i<count($res_new);$i++)
{
$strid= $res_new["$i"];
echo $strid; 
echo "<br/>";
}


?>

In the above sample example we are able to execute the first call of 
stored procedure.But it is showing warning message when we try to 
call the line "*****" above(calling second stored porcedure).It is 
showing warning message as 
"PHP Warning: mysqli::query() [<a href='function.mysqli-
query'>function.mysqli-query</a>]: Couldn't fetch mysqli
".We tried different ways can't able to solve this problem.

If any one knows how to solve this.Please help us.

Thanking u all.

 



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


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux