Buenas, miren voy a dejarle el codigo de dos paginas.php para que me digan donde hay algun error. Mi objetivo es primeramente un listado de las 6 noticias ultimas y que cada titulo de la noticia linkee con su id y en el otro archivo.php se dicte la noticia completa.
el index donde se listan las noticias carga bien pero al insertar una noticia desde el phpmyadmin no se refleja luego aqui, sin embargo se inserta correctamente.
en noticias.php me da un error que es:
ERROR: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/aymar/domains/aymar.es/public_html/new/noticias.php on line 24 la linea 24 es exactamente esta : while ($row2 = mysql_fetch_array ($res2)){ index.php Código PHP:
<?
echo "<table width='123' border='0' align='center' cellpadding='0' cellspacing='2'>
<tr>
<td height='10' colspan='2'><img src='images/transparente_presentacion.gif' width='2' height='10' /><img src='images/transparente_presentacion.gif' width='2' height='10' /></td>
</tr>
<tr>
<td height='25' colspan='2' bgcolor='#5C2216'><div align='center' class='tipografia_general_titulos'>Noticias</div></td>
</tr>";
include ('conexion.php');
conectar();
$sql = "SELECT * FROM noticias Where id_noticias ='".$id." ORDER BY id_noticias LIMIT 1,6 '";
$res = mysql_query($sql);
while ($row = mysql_fetch_array($res)){
echo "<tr>
<td width='15' bgcolor='#333333'><div align='center'><img src='images/icon-amarillo.gif' width='9' height='9' /></div></td>
<td width='102' height='18' bgcolor='#333333'><a href='".$row['id_noticias']."'>".$row['titulo']."</a></td>
</tr>
<tr>
<td bgcolor='#333333'> </td>
<td height='18' bgcolor='#333333'>";
function fecha(){
$mes = date("n");
$mesArray = array(
1 => "Enero",
2 => "Febrero",
3 => "Marzo",
4 => "Abril",
5 => "Mayo",
6 => "Junio",
7 => "Julio",
8 => "Agosto",
9 => "Septiembre",
10 => "Octubre",
11 => "Noviembre",
12 => "Diciembre"
);
$semana = date("D");
$semanaArray = array(
"Mon" => "Lunes",
"Tue" => "Martes",
"Wed" => "Miercoles",
"Thu" => "Jueves",
"Fri" => "Viernes",
"Sat" => "Sábado",
"Sun" => "Domingo",
);
$mesReturn = $mesArray[$mes];
$semanaReturn = $semanaArray[$semana];
$dia = date("d");
$año = date ("Y");
return $semanaReturn." ".$dia." de ".$mesReturn." de ".$año;
}
echo fecha();
echo "</td>
</tr>";
}
echo "</table>";
?>
noticias.php Código PHP:
<?
include ('conexion.php');
conectar();
$sql2 = "Select * From videos Where id_noticias = '".$_GET['id_noticias']."' ORDER BY id_noticias LIMIT 1";
$res2 = mysql_query($sql2);
while ($row2 = mysql_fetch_array ($res2)){
echo "<table width='435' border='0' align='center' cellpadding='0' cellspacing='2'>
<tr>
<td height='10'><img src='images/transparente_presentacion.gif' width='2' height='10' /></td>
</tr>
<tr>
<td height='25' bgcolor='#5C2216'><div align='center' class='tipografia_general_titulos'>".$row2['titulo']."</div></td>
</tr>
<tr>
<td height='102' valign='top' class='tipografia_general'><table width='433' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td width='281' height='102' valign='top'>".$row2['contenido']."</td>
<td width='150' valign='top'>".$row2['foto']."</td>
</tr>
</table></td>
</tr>
<tr>
<td class='tipografia_general'>"; function fecha(){
$mes = date("n");
$mesArray = array(
1 => "Enero",
2 => "Febrero",
3 => "Marzo",
4 => "Abril",
5 => "Mayo",
6 => "Junio",
7 => "Julio",
8 => "Agosto",
9 => "Septiembre",
10 => "Octubre",
11 => "Noviembre",
12 => "Diciembre"
);
$semana = date("D");
$semanaArray = array(
"Mon" => "Lunes",
"Tue" => "Martes",
"Wed" => "Miercoles",
"Thu" => "Jueves",
"Fri" => "Viernes",
"Sat" => "Sábado",
"Sun" => "Domingo",
);
$mesReturn = $mesArray[$mes];
$semanaReturn = $semanaArray[$semana];
$dia = date("d");
$año = date ("Y");
return $semanaReturn." ".$dia." de ".$mesReturn." de ".$año;
}
echo fecha();
echo "</td>
</tr>";
}
echo "</table>";
?>
estoy desesperado, espero me ayuden, un saludo y gracias