Hey i'm trying to call a procedure in a for loop but keep stumbling at the same error i've tried several things but just can't find the problem. here's a piece of my code
php:
for ($x=1; $x<=16; $x++)
{
$rs = mysql_query("CALL sp_programma(".$x.")");
$tmp='row'.$x;
$$tmp = mysql_fetch_array($rs);
}
?>
<body>
<div id="schoten">
<div class="plaats">Schoten</div>
<div class="dag">Maandag
<div class="les" id="S1"><?php echo $row1['Uur']; echo '</br>'; echo $row1['Omschrijving']; echo '</br>'; echo $row1['Omschrijving_grpnaam'] ?></div>
<div class="les" id="S2"><?php echo $row2['Uur']; echo '</br>'; echo $row2['Omschrijving']; echo '</br>'; echo $row2['Omschrijving_grpnaam'] ?></div>
and the stored procedure:
DROP PROCEDURE IF EXISTS circant.sp_programma;
CREATE PROCEDURE circant.`sp_programma`(param_name int)
BEGIN
SELECT tbl_groepen.Omschrijving_grpnaam, tbl_lessoorten.Omschrijving, tbl_lessen.Uur
FROM (circant.tbl_groepen tbl_groepen
INNER JOIN circant.tbl_lessen tbl_lessen
ON (tbl_groepen.ID = tbl_lessen.GroepID))
INNER JOIN circant.tbl_lessoorten tbl_lessoorten
ON (tbl_lessoorten.ID = tbl_lessen.Les_soort_ID)
where tbl_groepen.ID = param_name;
END;
only the first works (row1) but then for row2 and so on i get the error: Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\Circant_beter\Agenda.php on line 18
does any body know what i'm doing wrong?