Sí... la conexión está... o sino no me mostraría las noticias :/...
te pongo el código entero mejor :/...
Código PHP:
function aceptarNoticias()
{
$op = $_GET['op'];
$do = $_GET['do'];
if($op == 'Noticias') {
switch( $do ) {
case 'aceptarNoticia':
$submit = "<input type=\"submit\" name=\"aceptarNoticia\" value=\"Aceptar Noticias\">";
$query = mysql_query("SELECT * FROM news WHERE estado='0' ORDER BY new_id DESC");
break;
case 'negarNoticia':
$submit = "<input type=\"submit\" name=\"negarNoticia\" value=\"Negar Noticias\">";
$query = mysql_query("SELECT * FROM news WHERE estado='1' ORDER BY new_id DESC");
break;
}
// ACEPTAMOS O NEGAMOS LAS NOTICIAS
if(isset($_POST['aceptarNoticia'])) {
foreach($_POST['noticia'] as $noticiaId) {
$noticiaId = trim($noticiaId);
echo $noticiaId;
$update = mysql_query("UPDATE news SET estado='0' WHERE new_id=".$noticiaId."");
if(!$update) {
die(mysql_error());
}
}
}
/*if(isset($_POST['negarNoticia'])) {
$select = mysql_query("SELECT * FROM news ORDER BY new_id DESC LIMIT 1");
$r = mysql_fetch_assoc($select);
for($i = 1; $i <= $r['new_id']; $i++) {
$update = mysql_query("UPDATE news SET estado='1'
WHERE new_id='".$_POST['noticia_'.$i]."'")
or die(mysql_error());
}
if($update) {
header('Location: '.$_SERVER['REQUEST_URI']); die();
}
}*/
// MOSTRAMOS LAS NOTICIAS
$titulo = "Administrar Noticias";
$contenido = "
<br>
<form method=\"post\" action=\"$_SERVER[REQUEST_URI]\">
<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">
<tr>
<tbody style='font-weight:bold;font-family:Verdana;font-size:10px;color:#a1a1a1;'>
<td></td>
<td>Título Noticia</Td>
<td align=\"center\">ID Noticia</td>
</tbody>
<tbody style=\"font-family:Verdana;font-size:12px;\">
";
while($row = mysql_fetch_assoc($query)) {
$id = $row['new_id'];
$contenido .= "
<tr>
<td>
<input type=\"checkbox\" name=\"noticia[]\" value=\"$id\">
</td>
<td>".$row['titulo']."</td>
<td align=\"center\">$id</td>
</tr>
";
}
$contenido .= "
</tbody>
</tr>
</table>
<br>
$submit
</form>";
adminBox($titulo, $contenido);
}
}