Buenas, estoy atascado...a ver si me pudieran ayudar un poquito...
Me duplica los campos que modifico como a oferta. Quan actualizo un registro i lo pongo como inmueble destacado ( marcando el radio oferta si ), el documento ( mostra1.php ) me lo muestra destacado i sin destacar, vaya que lo duplica, lo muestra dos veces, una en color amarillo ( propio del destacado ) i el otro en gris. Solo lo tendria que mostrar en amarillo. Algo debo hacer mal en el condicional if else...no se...
Gràcias i buenas vacaciones si las empezais hoy.
<?
require ("conexion.php");
$result = mysqli_query($enlace, "SELECT * FROM taula_pisos");
echo "<table border='1' align='center' cellspacing='0' cellpadding='0'>";
echo "<tr bgcolor='#CCCCCC'>";
echo "<td align='center'><b>Tipus</b></td>";
echo "<td align='center'><b>Carrer</b></td>";
echo "<td align='center'><b>Zona</b></td>";
echo "<td align='center'> <b>M2</b></td>";
echo "<td align='center'><b>Habitacions</b></td>";
echo "<td align='center'><b>Banys</b></td>";
echo "<td align='center'><b>Alçada de Pis</b></td>";
echo "<td align='center'><b>Certificat Energètic</b></td>";
echo "<td align='center'><b>Preu</b></td>";
echo "<td align='center'><b>Seleccionar</b></td>";
echo "<td align='center'><b>Eliminar</b></td>";
echo "<td align='center'><b>Editar</b></td>";
echo "<td align='center'><b>Fotografies</b></td>";
echo "</tr>";
while ($row = mysqli_fetch_array($result))
if ($colorfila==0){
echo "<form name='form1' method='post' action='mostrar1.php'><tr>";
echo "<td height='50' class='gris_clar' align='center'>".$row[tipus]."</td>";
echo "<td class='gris_clar' align='center'>".$row[carrer]."</td>";
echo "<td class='gris_clar' align='center'>".$row[zona]."</td>";
echo "<td class='gris_clar' align='center'>".$row[m2]."</td>";
echo "<td class='gris_clar' align='center'>".$row[habitacions]."</td>";
echo "<td class='gris_clar' align='center'>".$row[banys]."</td>";
echo "<td class='gris_clar' align='center'>".$row[alsadapis]."</td>";
echo "<td class='gris_clar' align='center'>".$row[certificat]."</td>";
echo "<td class='gris_clar' align='center'>".$row[preu]."€</td>";
echo "<td class='gris_clar'width='100' height='75' class='gris_clar' align='center'><input type='checkbox' name='id' value='".$row[id]."'></td>";
echo "<td class='gris_clar'align='center'></><input type='image' src='eliminar.jpg' value='Eliminar'></form>";
echo "<td class='gris_clar' ><a href='modi123.php?id=".$row[id]."'><img src='editar.jpg' width='46' height='21'></a>
<td class='gris_clar'><a href='fotosfotos.php?id=".$row[id]."'><img src='fotografies.jpg' width='46' height='21'></a></td>";
echo "<tr><td class='gris_clar2' colspan='14'><details><summary>Comentaris</summary>".$row[comentaris]."</td></details>";
echo "</tr>";
$colorfila=1;
$oferta=$row['oferta'];
if ($oferta=='si'){
echo "<form name='form1' method='post' action='mostrar1.php'><tr>";
echo "<td bgcolor='#FFFFCC'height='50' align='center'>".$row[tipus]."</td>";
echo "<td bgcolor='#FFFFCC' align='center'>".$row[carrer]."</td>";
echo "<td bgcolor='#FFFFCC'align='center'>".$row[zona]."</td>";
echo "<td bgcolor='#FFFFCC'align='center'>".$row[m2]."</td>";
echo "<td bgcolor='#FFFFCC' align='center'>".$row[habitacions]."</td>";
echo "<td bgcolor='#FFFFCC' align='center'>".$row[banys]."</td>";
echo "<td bgcolor='#FFFFCC'align='center'>".$row[alsadapis]."</td>";
echo "<td bgcolor='#FFFFCC' align='center'>".$row[certificat]."</td>";
echo "<td bgcolor='#FFFFCC' align='center'>".$row[preu]."€</td>";
echo "<td bgcolor='#FFFFCC'width='100' height='75' align='center'><input type='checkbox' name='id' value='".$row[id]."'></td>";
echo "<td bgcolor='#FFFFCC' align='center'></><input type='image' src='eliminar.jpg' value='Eliminar'></form>";
echo "<td bgcolor='#FFFFCC'><a href='modi123.php?id=".$row[id]."'><img src='editar.jpg' width='46' height='21'></a>
<td bgcolor='#FFFFCC'><a href='fotosfotos.php?id=".$row[id]."'><img src='fotografies.jpg' width='46' height='21'></a></td>";
echo "<tr><td bgcolor='#FFFFCC' colspan='14'><details><summary>Comentaris-----------------------------------------<strong>IMMOBLE DESTACAT</strong>----------------------------------------</summary>".$row[comentaris]."</td>";
echo "</details>";
echo "</tr>";
$colorfila=0;
}
}
else{
echo "<form name='form1' method='post' action='mostrar1.php'><tr>";
echo "<td height='50' class='gris_fosc' align='center'>".$row[tipus]."</td>";
echo "<td class='gris_fosc' bgcolor='#99CCFF'align='center'>".$row[carrer]."</td>";
echo "<td class='gris_fosc' bgcolor='#99CCFF'align='center'>".$row[zona]."</td>";
echo "<td class='gris_fosc' bgcolor='#99CCFF'align='center'>".$row[m2]."</td>";
echo "<td class='gris_fosc' bgcolor='#99CCFF'align='center'>".$row[habitacions]."</td>";
echo "<td class='gris_fosc' bgcolor='#99CCFF'align='center'>".$row[banys]."</td>";
echo "<td class='gris_fosc align='center'>".$row[alsadapis]."</td>";
echo "<td class='gris_fosc align='center'>".$row[certificat]."</td>";
echo "<td class='gris_fosc' align='center'>".$row[preu]."€</td>";
echo "<td width='100' height='75'class='gris_fosc' align='center'><input type='checkbox' name='id' value='".$row[id]."'></td>";
echo "<td class='gris_fosc' align='center'></><input type='image' src='eliminar.jpg' value='Eliminar'></form>";
echo "<td class='gris_fosc'><a href='modi123.php?id=".$row[id]."'><img src='editar.jpg' width='46' height='21'></a>
<td class='gris_fosc'><a href='fotosfotos.php?id=".$row[id]."'><img src='fotografies.jpg' width='46' height='21'></a></td>";
echo "<tr><td class='gris_fosc1' colspan='14'><details><summary>Comentaris</summary>".$row[comentaris]."</td>";
echo "</details>";
echo "</tr>";
$colorfila=0;
$oferta=$row['oferta'];
if ($oferta=='si'){
echo "<form name='form1' method='post' action='mostrar1.php'><tr>";
echo "<td bgcolor='#FFFFCC'height='50' align='center'>".$row[tipus]."</td>";
echo "<td bgcolor='#FFFFCC' align='center'>".$row[carrer]."</td>";
echo "<td bgcolor='#FFFFCC'align='center'>".$row[zona]."</td>";
echo "<td bgcolor='#FFFFCC'align='center'>".$row[m2]."</td>";
echo "<td bgcolor='#FFFFCC' align='center'>".$row[habitacions]."</td>";
echo "<td bgcolor='#FFFFCC' align='center'>".$row[banys]."</td>";
echo "<td bgcolor='#FFFFCC'align='center'>".$row[alsadapis]."</td>";
echo "<td bgcolor='#FFFFCC' align='center'>".$row[certificat]."</td>";
echo "<td bgcolor='#FFFFCC' align='center'>".$row[preu]."€</td>";
echo "<td bgcolor='#FFFFCC'width='100' height='75' align='center'><input type='checkbox' name='id' value='".$row[id]."'></td>";
echo "<td bgcolor='#FFFFCC' align='center'></><input type='image' src='eliminar.jpg' value='Eliminar'></form>";
echo "<td bgcolor='#FFFFCC'><a href='modi123.php?id=".$row[id]."'><img src='editar.jpg' width='46' height='21'></a>
<td bgcolor='#FFFFCC'><a href='fotosfotos.php?id=".$row[id]."'><img src='fotografies.jpg' width='46' height='21'></a></td>";
echo "<tr><td bgcolor='#FFFFCC' colspan='14'><details><summary>Comentaris-----------------------------------------<strong>IMMOBLE DESTACAT</strong>----------------------------------------</summary>".$row[comentaris]."</td>";
echo "</details>";
echo "</tr>";
$colorfila=0;
}
}
echo "</table>";
mysqli_close($enlace);
?>
© 2014 Microsoft Términos Privacidad y cookies Desarrolladores Español