'nDì
dovrei dividere/separare in tre zone distinte un pannello admin che passa dei dati al db.. le tre distinte categorie Tabellone A, B, C scrivono nel stesso db e cartella, ma non saprei come poterla impostare! :master:
Qualche consiglio?
la pagina admin:
codice:
<?php
define('FLASH_NEWS' , TRUE);
include('admin/functions.php');
connect('root', '', 'parse', 'localhost');
//define variables
$mode = ( isset( $_POST['mode'] ) ) ? $_POST['mode'] : ( ( isset( $_GET['mode'] ) ) ? $_GET['mode'] : '' );
$action = ( isset( $_POST['action'] ) ) ? $_POST['action'] : ( ( isset( $_GET['action'] ) ) ? $_GET['action'] : '' );
$id = ( isset( $_GET['id'] ) ) ? intval($_GET['id']) : ( (isset($_POST['id'] ) ) ? intval($_POST['id'] ) : '' );
//What needs to be done?
if( $mode != '' ){
switch($mode){
case 'add' :
case 'edit' :
include( 'admin/actions.php');
break;
case 'delete' :
//DELETE NEWS ENTRY
$query = 'DELETE FROM flash_news
WHERE id = ' . $id ;
if(mysql_query($query)){
echo 'Delete Sucessful!';
}else{
echo 'Could Not Delete News..' . mysql_error();
}
break;
//DEFAULT TO INVALID
default :
echo 'Invalid Request';
}
}else{
//LIST ALL NEWS ENTRIES FOR US TO VIEW
$query = 'SELECT id, title , FROM_UNIXTIME(timestamp, \'%M %D %Y \') date FROM flash_news';
$result = mysql_query($query);
echo '<table style="margin: 0 auto;width:500px;border: 1px dotted #E5E5E5;" cellpadding="5" cellspacing="1">
<tr>
<th>Title</th><th>Published</th><th>Edit</th><th>Delete</th>';
while($r = mysql_fetch_array($result)){
//Swap our CSS classes
$bg = 'light' ? 'light' : 'dark';
echo '
<tr class="' . $bg . '"><td>' . stripslashes2($r['title']) . '</td>
<td>' . $r['date'] . '</td>
<td>Edit</td>
<td>Delete</td></tr>';
}
echo '</table>';
}
?>