Hola dónde está lo que estoy haciendo mal? ME podéis ayudar por favor a ver qué pudo modificar?
Parse error: syntax error, unexpected 'echo' (T_ECHO) in C:\xampp\htdocs\delos\materialvisitas.php on line 190
<?php
$conexio=mysqli_connect("localhost","root","") or die("Problemas en la conexion");
mysqli_select_db($conexio,"ugtdef") or die("Problemas en la seleccin de la base de datos");
?>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<?php
$result=$conexio->query("SELECT * FROM materialvisitas ORDER BY fecha DESC");
?>
<table class="table table-condensed table-hover table-bordered table-striped text-justify">
<tr><td colspan="5"><strong> Material Ordenado Por Fecha (Working Progress)</strong></td></tr>
<tr>
<td><div class="sizef"><strong> Fecha Material</strong></div></td>
<td><strong> Archivo </strong></td>
<td><strong> Nombre </strong></td>
<td><strong> Nombre Largo</strong></td>
<td><strong> Descripción y observaciones</strong></td>
</tr>
<?php
while ($row=$result->fetch_array(MYSQLI_ASSOC){
echo "</tr>";
echo "<td>$row[1]</td>";
echo "<td>$row[2]</td>";
echo "<td><a href=$row[5]>Descargar Fichero</a></td>";
echo "<td>$row[2]</td>";
echo "<td>$row[3]</td>";
//echo "<td >$row[4]</td>";
echo "</tr>";
$result->free;
} else {
exit($mysqli -> error); // this will show the error (if exists)
}
?>
</table>
</div>
</div>
Mod: Temas sobre PHP van al subforo de PHP.
Cual es la línea 190?
Saludos
Es esta parte a partir del primer echo:
while ($row=$result->fetch_array(MYSQLI_ASSOC){
echo "</tr>";
echo "<td>$row[1]</td>";
echo "<td>$row[2]</td>";
echo "<td><a href=$row[5]>Descargar Fichero</a></td>";
echo "<td>$row[2]</td>";
echo "<td>$row[3]</td>";
//echo "<td >$row[4]</td>";
echo "</tr>";
Añadi esto ( $result->free;) pero vamos el error se detiene aquí en el primer echo del código.
Te falta cerrar el while.
while($row = $result->fetch_array(MYSQLI_ASSOC)) {
PD: Cuando te dice que no esperaba algo en X línea, es que en las líneas previas hay algún fallo.
Saludos
Sí es verdad lo he copiado mal pero con el paréntesis me sale este error:
Fatal error: Uncaught Error: Call to a member function fetch_array() on bool in C:\xampp\htdocs\delegados\materialvisitas.php:186 Stack trace: #0 {main}thrown in C:\xampp\htdocs\delegados\materialvisitas.php on line 186
La línea 186 es while ($row=$result->fetch_array(MYSQLI_ASSOC)){
Este es el código entero:
<div class="col-lg-12 ">
<div class="table-responsive " border="1" align="left">
<?php
$conexio=mysqli_connect("localhost","root","") or die("Problemas en la conexion");
mysqli_select_db($conexio,"ugtdef") or die("Problemas en la seleccin de la base de datos");
?>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<?php
$result=$conexio->query("SELECT * FROM materialvisitas ORDER BY fecha DESC");
?>
<table class="table table-condensed table-hover table-bordered table-striped text-justify">
<tr><td colspan="5"><strong> Material Ordenado Por Fecha (Working Progress)</strong></td></tr>
<tr>
<td><div class="sizef"><strong> Fecha Material</strong></div></td>
<td><strong> Archivo </strong></td>
<td><strong> Nombre </strong></td>
<td><strong> Nombre Largo</strong></td>
<td><strong> Descripción y observaciones</strong></td>
</tr>
<?php
while ($row=$result->fetch_array(MYSQLI_ASSOC)){
echo "</tr>";
echo "<td>$row[2]</td>";
echo "<td><a href=$row[5]>Descargar Fichero</a></td>";
echo "<td>$row[2]</td>";
echo "<td>$row[3]</td>";
echo "<td >$row[4]</td>";
echo "</tr>";
}
?>
</table>