Ver Mensaje Individual
  #3 (permalink)  
Antiguo 27/04/2007, 19:38
Ioryo
 
Fecha de Ingreso: abril-2007
Mensajes: 127
Antigüedad: 17 años, 9 meses
Puntos: 0
Re: Problema al insertar datos en una tabla

Bueno logre hacer andar eso, ahora me faltaria esas 3 lineas de errores, que si bien no impiden el buen funcionamiento del sistema de noticias, no deberian estar.

Por otro lado, tengo este problema, cuando muestro los resultados lo hago de la siguiente manera, para que tenga una linda estetica, el tema es que solo se ve bien cuando es 1 noticia, si son mas las tablas se desacomodan:

Código PHP:
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>


<?php
//Connect to db:
$connect=mysql_connect("localhost","root","123456");

//Select db:
mysql_select_db("wi140043_noticias",$connect);

//Consult:
$result=mysql_query("SELECT * FROM noticias ORDER BY fecha DESC",$connect);
?>

<body>

<table border=0 cellpadding=0 cellspacing=0>
<td>

<table width=152 height=30 border=0 cellpadding=0 cellspacing=0>
<td background="img/post_menu1.jpg">
<p align="center"><b>Autor</b></p>
</table>

<?php
//Get the results of the consult in an array and show them:
while($row=mysql_fetch_array($result))
{
echo 
'
<table width=152 height=30 border=0 cellpadding=0 cellspacing=0>
<td background="img/post_fondo1_1.jpg">
<p><b>'
.$row["autor"].'</b></p>
</table>

<table width=152 height=160 border=0 cellpadding=0 cellspacing=0>
<td background="img/post_fondo1_2.jpg">
</table>

<table width=152 height=30 border=0 cellpadding=0 cellspacing=0>
<td background="img/post_fondo1_3.jpg">
</table>

<td>

<table width=565 height=30 border=0 cellpadding=0 cellspacing=0>
<td background="img/post_menu2.jpg">
<p align="center"><b>Mensaje</b></p>
</table>

<table width=565 height=30 border=0 cellpadding=0 cellspacing=0>
<td background="img/post_fondo2_1.jpg">
<p><b>Publicado: </b>'
.$row["fecha"].'<br>
<b>Titulo del mensaje: </b>'
.$row["titulo"].'</p>
</table>

<table width=565 height=160 border=0 cellpadding=0 cellspacing=0>
<td background="img/post_fondo2_2.jpg">
<p>'
.$row["noticia"].'</p>
</table>

<table width=565 height=30 border=0 cellpadding=0 cellspacing=0>
<td background="img/post_fondo2_3.jpg">
<p align="right"><a href="admin_noticias.php"><b>[ Nuevo ]</b></a>
<a href="editar_noticia.php?id='
.$row["id_noticia"].'"><b>[ Editar ]</b></a>
<a href="borrar_noticia.php?id='
.$row["id_noticia"].'"><b>[ Borrar ]</b></a></p>
</table>'
;
}
mysql_free_result($result);
mysql_close($connect);
?>

</body>
</html>
Como hago para que lo que esta dentro del bucle (while), se vea correctamente con 1 o n noticias.

Por ultimo pregunto, siempre que me conecte a la db, al finalizar las consultas deberia cerrar la conexion?

Gracias.