ciao a tutti, sto provando a sviluppare alcuni script utilizzando le SP, però già alla prima chiamata mi trovo bloccato da questo errore
lo script che sto provando ad eseguire è questo:codice:Database Error: 2014 (Commands out of sync; you can't run this command now)
index.php
/layoutGestione.phpcodice:<?php $listOfData = getDataFromQuery($db,"call extMenu(0,0)"); require_once(dirname (__file__)."./layoutGestione.php"); ?>
stored procedurecodice:<div align="center"> <table border="0" bgcolor="#ffffff" cellpadding="0" cellspacing="0" width="100%"> <tr> <td align="center" valign="top" class="blu"> <div align="center"> <b class="blu">#ADMPAGETITLE#[/b] </div> <table align="center" cellpadding="5" cellspacing="2" border="0" style="border:thin" bordercolor="#00000"> <tr> <td align='center' colspan='9'> AGGIUNGI NUOVO MENU </td> </tr> <tr> <td align='center'>TESTO ITA</td> <td align='center'>STATUS</td> <td align='center'>OPERAZIONI</td> </tr> <?php foreach($listOfData AS $elem): //l'errore è prodotto da questa riga $listOfDataSub = getDataFromQuery($db,"call extMenu(0,".$elem['idmenu'].")"); ?> <tr onMouseOver='cambio_sfondo(this);' onMouseOut='sfondo_bianco(this,"#ffffff");'> <td align='left' valign='top'><?php echo $elem['testo_ITA']; ?></td> <td align='left' valign='top'><?php echo $elem['status']; ?></td> <td align='left' valign='top'>Modifica - Cancella - Aggiungi sottomenu</td> </tr> <?php endforeach; ?> <tr> <td align='right' colspan='9'>TOTALE RECORD TROVATI: <?php echo count($listOfData);?></td> </tr> </table> </td> </tr> </table> </div>
view vmenucodice:-- -------------------------------------------------------------------------------- -- Routine DDL -- Note: comments before and after the routine body will not be stored by the server -- -------------------------------------------------------------------------------- DELIMITER $$ CREATE DEFINER=`root`@`localhost` PROCEDURE `extMenu`(input int, idpadre INT) BEGIN declare str varchar(10000) default "SELECT * FROM `vmenu` WHERE idmenupadre = "; set str = concat(str,idpadre); IF input > 0 THEN set str = concat(str," AND idmenu = ",input); END IF; set @str = str; prepare stmt from @str; execute stmt; deallocate prepare stmt; END
codice:+ ----------- + ---------------- + ---------------- + ----------- + -------------- + -------------- + -------------- + | idmenu | idbk_utenti | idmenupadre | status | testo_ITA | testo_ENG | testo_FRA | + ----------- + ---------------- + ---------------- + ----------- + -------------- + -------------- + -------------- + | 2 | 1 | 0 | on | menu 2 | menu 2 | menu 2 | | 5 | 1 | 0 | on | menu 5 | menu 5 | menu 5 | | 6 | 1 | 2 | on | menu 6 | menu 6 | menu 6 | | 7 | 1 | 0 | on | menu 7 | menu 7 | menu 7 | | 8 | 1 | 2 | on | menu 8 | menu 8 | menu 8 | + ----------- + ---------------- + ---------------- + ----------- + -------------- + -------------- + -------------- +

Rispondi quotando