I have the PHP script :
<?php
$count=1;
$result = $db_connection->prepare("SELECT tid, title FROM message");
$result->execute();
while($row = $result->fetch())
{
$co_count = 0;
$cosql = $db_connection->prepare("CALL sp_getresp(?);");
$cosql->execute(array($row['tid']));
while($row3 = $cosql->fetch())
{
// GET USERS INFO
$couser = $db_connection->prepare("CALL sp_getuserinfo(?);");
$couser->execute(array($row3['couid']));
$row4 = $couser->fetch();
var_dump($row4);
echo '<BR>'.$row['tid'].$row4['email'].'<BR>';
$count++;
}
}
?>
In the above code, I try to run the stored procedure. It is working fine except, in the first loop, it doesnt give any data even the data is present. I tried many tests, but $row4['email'] always shows empty in the first loop time, after first loop, it runs fine. I also check directly calling CALL sp_getuserinfo(?);
in the mysql where it works fine but not here. I dont understand what is the problem here ?