Problema di sintassi
-
Salve a tutti, ho appena iniziato ad usare php e ho dei problemi con la sintassi di un pezzo. non riesco proprio a capire dov'è l'errore, mi sembra di aver fatto tutto giusto ma evidentemente mi sta sfuggendo qualcosa anche perchè ribadisco, sono una principiante e spesso commetto errori stupidi. Sarei infinitamente grata a chi volesse aiutarmi a risolvere questo problema che mi sta facendo perdere la testa da ore!! E' un pò lungo ma l'errore è proprio nelle ultime righe! Grazie mille!!!!

if($mode=="u" && isset($idUtente)){ if($cat==""||$cat==NULL) { //stampiamo tutti gli annunci del db dell'utente ordinati per categorie echo("<table id=title3><tr><td><h2>I miei annunci</h2></td></tr></table>"); $rCategorie=mysql_query("SELECT * FROM categorie"); echo("<table id=annuncio>"); while($row=mysql_fetch_array($rCategorie)){ $countQ=mysql_query("SELECT COUNT(*) FROM annunci WHERE idCategoria=".$row[0]." AND idUtente=".$idUtente); $countR=mysql_fetch_array($countQ); if($countR[0]>0){ echo("<tr>"); $idCategoria=$row[0]; echo("<td><a href=\"viewAnnunci2.php?m=u&cat=".$row[0]."\"><h2>".$row[1]."</h2></a></td>"); $rAnnunci=mysql_query("SELECT * FROM annunci WHERE idCategoria=".$idCategoria." ORDER BY dataIns DESC LIMIT 0, 5"); if (!$rAnnunci) { echo "Fallimento nell'esecuzione della query dal DB: " . mysql_error(); exit; } while($rowA=mysql_fetch_assoc($rAnnunci)){ ?> <td> <table width="200px" > <tr> <td><a href="viewDettaglioAnnuncio.php?id=<?php echo($rowA['idAnnuncio']); ?>"><h3><?php echo($rowA['titolo']);?></h1></a></td> <td><?php if(isset($idUtente)&& $idUtente==$riga['idUtente']&& $idUtente==$riga['idUtente']){ ?> <form action="doRimuovi.php" method="post" name="rimuovi"> <input type="hidden" name="idAnnuncio" value="<?php echo($riga['idAnnuncio']);?>" /> <input ALIGN="RIGHT" type="submit" value="Elimina" /> </form> <?php } ?></td> </tr> <tr> <td><p><?php $desc = substr( $rowA['descrizione'], 0, 20 ); $desc=$desc."..."; echo($desc);?></p></td> <td> <?php if($rowA['immagine']!=NULL){ ?> <a href="<?php echo($rowA['immagine'])?>"><img src="<?php echo($rowA['immagine'])?>" height="50px" /></a> <?php }else{ ?> <img src="images/no_image.gif" height="50px" /> <?php }?> </td> </tr> <tr><td colspan="2">Inserito il: <?php echo($rowA['dataIns']);?></td></tr> </table> </td> <?php } echo("</tr>"); //echo("<tr><td colspan=\"6\"><hr /></td></tr>"); } } echo("</table>"); } else { // visualizzo una sola categoria $rCat=mysql_query("SELECT nomeCat FROM categorie WHERE idCategoria=".$cat); $nomeCat=mysql_fetch_array($rCat); echo("<table id=\"borderCat\"><tr><td>"); echo("<tr><td class=\"titleCat\"><h2>".$nomeCat[0]."</h2></td></tr><tr><td>"); $rAnnunci=mysql_query("SELECT * FROM annunci WHERE idCategoria=".$cat." ORDER BY dataIns DESC"); ?> <table id="annuncio"> <?php if (!$rAnnunci) { echo "Fallimento nell'esecuzione della query dal DB: " . mysql_error(); exit; } while($riga=mysql_fetch_assoc($rAnnunci)){ ?> <tr> <td> <table> <tr> <td><a href="viewDettaglioAnnuncio.php?id=<?php echo($riga['idAnnuncio']); ?>"><h3><?php echo($riga['titolo']);?></h3></a></td> <td><?php if(isset($idUtente)&& $idUtente==$riga['idUtente']&& $idUtente==$riga['idUtente']){ ?> <form action="doRimuovi.php" method="post" name="rimuovi"> <input type="hidden" name="idAnnuncio" value="<?php echo($riga['idAnnuncio']);?>" /> <input ALIGN="RIGHT" type="submit" value="Elimina" /> </form> <?php } ?></td> </tr> <tr> <td> <?php if($riga['immagine']!=NULL){ ?> <a href="<?php echo($riga['immagine'])?>"><img src="<?php echo($riga['immagine'])?>" height="50px" /></a> <?php }else{ ?> <img src="images/no_image.gif" height="50px" /> <?php }?> </td> <td><p><?php $l=strlen($riga['descrizione']); if($l>400){$desc = substr( $riga['descrizione'], 0, 400 ); $desc=$desc."..."; echo($desc);} else {echo($riga['descrizione']);} ?></p></td> </tr> <tr><td colspan="2">Inserito il: <?php echo($riga['dataIns']);?></td></tr> </table> </td> </tr></table> <?php } ?> </table> </td></tr></table> <?php } } include("include/footer.inc"); ?> -
Ciao Freckles,
dovresti anche incollarci l'errore, cosi evitiamo di controllarlo per intero inutilmente. -
-
Aggiungi una } prima dell'include, che da uno sguardo veloce mi sembra manca la chiusura del primo ciclo.
-
Ciao! Sembra che tu sia interessato a questa conversazione, ma non hai ancora un account.
Stanco di dover scorrere gli stessi post a ogni visita? Quando registri un account, tornerai sempre esattamente dove eri rimasto e potrai scegliere di essere avvisato delle nuove risposte (tramite email o notifica push). Potrai anche salvare segnalibri e votare i post per mostrare il tuo apprezzamento agli altri membri della comunità.
Con il tuo contributo, questo post potrebbe essere ancora migliore 💗
Registrati Accedi