Código :
<?php $sql = new mysqli("localhost","root","x151181b","izcay"); if(mysqli_connect_errno()){ printf("Error connecting to database: %s\n",mysqli_connect_error()); exit(); } if($stmt = $sql->prepare("SELECT header,body,published,user_id FROM news")){ $stmt->execute(); //bind results to variables $stmt->bind_result($head,$body,$published,$u_id); //fetch results while($stmt->fetch()){?> <div id="newsBlock"> <h2><?php printf("%s",$head); ?></h2> <p><?php printf("%s",$body); ?></p> <h4><?php printf("%s %s", $published,$u_id); ?></h4> </div> <?php} //CASCA AQUÍ, DICE QUE NO SE ESPERABA LA LLAVE DE CIERRE stmt->close(); } $sql->close(); ?>