I have 2 procedures stored in the same file, the connection is made correctly because if I delete any of the 2 procedures, the other one shows information but if I leave both, only the first one is executed.
I have the file conectar.php
with the following code:
class Clase_Conecta{
var $_Server = 'localhost';
var $_User = 'root';
var $_Password = '';
var $_Bd = 'bd1';
function Fn_getConnect(){
if (!($conexion = new mysqli($this -> _Server, $this -> _User, $this -> _Password, $this -> _Bd))){
echo "Error Conectando la base de Datos";
exit();
}else{
echo "conexion exitosa";
}
return $conexion;
}
}
And my file principal.php
with the following:
include ("conectar.php");
$Fn = new Clase_Conecta();
$Cn = $Fn -> Fn_getConnect();
$sql1 = "call sp1()";
$r = query($sql1);
while ($rP = $r -> fetch_array()){
//Imprime tabla
}
//Hasta aquí funciona bien pero si quiero ejecutar otro procedimiento almacenado no lo hace
//solo ejecuta el de arriba (el primero)
$sql2 = "call sp2()";
$r2 = query($sql2);
while ($rP2 = $r2 -> fetch_array()){
//Imprime tabla
}
I imagine that I am misunderstanding the concepts but I have already read and investigated and it is not entirely clear to me, please if someone is so kind to orient me that I am doing wrong or that I am omitting