Aggiungi un bampo pub nella tabella "articoli".
poi...
modifichi la pagina di modifica cosi:
Codice PHP:
<?php
include("config.php");
mysql_connect($db_host,$db_user,$db_password,$db_name) or die ("errore nella connessione");
mysql_select_db("$db_name") or die ("errore nella selezione del database");
$count = mysql_query("SELECT COUNT(art_id) FROM articoli");
$res_count = mysql_fetch_row($count);
$tot_records = $res_count[0];
$per_page = 5;
$tot_pages = ceil($tot_records / $per_page);
$current_page = (!$_GET['page']) ? 1 : (int)$_GET['page'];
$primo = ($current_page - 1) * $per_page;
echo "<div align=\"center\">\n<table>\n";
$query_limit = mysql_query("SELECT art_id, titolo FROM articoli LIMIT $primo, $per_page");
while($results = mysql_fetch_array($query_limit)) {
echo " <tr>";
echo "<td><a href=\"page.php?id=" . $results['art_id'] . "\">" . $results['titolo'] . "</a></td>";
echo "<td><a href=\"modifica.php?id=" . $results['art_id'] . "\">modifica</td> ";
echo "<td><a href=\"elimina.php?id=" . $results['art_id'] . "\">elimina</td> ";
echo "<td><a href=\"pubblica.php?id=" . $results['art_id'] . "\">pubblica</td> ";
echo "</tr>";
}
include("paginazione_2.php");
//include("paginazione_1.php");
echo " <tr>\n <td height=\"50\" valign=\"bottom\" align=\"center\">$paginazione</td>\n";
echo " </tr>\n</table>\n</div>";
mysql_close();
?>
e crei una pagina chiamata [b]pubblica.php[/p] e ci metti dentro:
Codice PHP:
<?php
include("config.php");
mysql_connect($db_host,$db_user,$db_password,$db_name) or die ("errore nella connessione");
mysql_select_db("$db_name") or die ("errore nella selezione del database");
$sql = "UPDATE articoli SET pub = '0'";
mysql_query($sql);
$sql = "UPDATE articoli SET pub = '0' WHERE art_id = '".$_GET['id']."'";
mysql_query($sql);
// fai un redirect a dove vuoi tu
?>
Cosi ti viene pubblicata solo una news per volta.
L'alternativa sarebbe pubblicare più news divise per pagine, ma è da rivedere un po tutta la struttura.