I am using CodeIgniter and I have the following function in my controller:
public function miFuncion{
$sql_fecha = "CALL db.spFECHA();";//obtiene una fecha en formato datetime
$query = $this->db->query($sql_fecha);
$sql1 = "CALL db.spReport1('".$query."');";
$sql2 = "CALL db.spReport2('".$query."');";
$query1 = $this->db->query($sql1);
$query2 = $this->db->query($sql2);
}
The variable $sql_fecha
is executed without problem because I did a test where I print the result in a table and there is no problem, but if I want to use the result that is saved in $query
to pass it to another procedure it does not consider it, I have tried to do a echo $query;
but it does not print any.
I think there is something that I am not understanding yet, since I have always made the queries in my controller and I always print the result in a table but now I found this new situation where the result obtained I have to send it in a variable to another stored procedure , also change the variable $query
for a fixed date in the parameters of $sql1
and $sql2
and it does it without any problem.
When you call your SP with parameter it is something like this: