Ciao ragazzi, ho un problema, ho preso una pagina fatta, e stavo cambiando la visualizzazione, inserendo altre colonne che mi interessano,
ho riesaminato il file, e aggiungendo la colonna...non riesco a farlo visualizzare,
credo sia un problema di $output
vi posto il pezzo di codice, vediamo se riusciamo a trovare cosa manca...
Codice PHP:
<div>
<?php
//show_user.php
$per_page = 20;
$pagination = false;
$page = isset($_GET['page']) ? (int)$_GET['page'] : 1;
$b = isset($_GET['b']) ? $_GET['b'] : false;
$start = ($page * $per_page) - $per_page;
$sql = "SELECT id FROM registroutenti";
$res = mysql_query($sql);
$total_rows = mysql_num_rows($res);
if ($total_rows) {
$num_pages = ceil($total_rows / $per_page);
}
if ($total_rows > $per_page) {
$pagination = true;
}
$sql = "SELECT id, nome, cognome, telefono, email FROM registroutenti LIMIT " . $start . ", " . $per_page;
$res = mysql_query($sql);
if ($total_rows == 0) {
echo '<tr><td colspan="5">[b]Nessun utente è stato definito[/b]</td></tr>';
} else {
?>
<table class="amministrazione" cellpadding="0" cellspacing="0">
<tr><th>Scheda N�</th><th>Nome</th><th>Cognome</th><th>Tel.</th><th>Email</th><th></th></tr>
<?php
while ($rows = mysql_fetch_array($res)) {
$output = '<tr><td>[url="?m=user_details&id=' . $rows['id'] . '"]' . sprintf('%010s', $rows['id']) . '[/url]</td><td>' . $rows['nome'] . '</td>';
$output .= '<td>' . $rows['cognome'] . '</td><td>' . $rows['telefono'] . '</td><td>[email="' . $rows['email'] . '"]' . $rows['email'] . '[/email]</td>';
$output .= '<td>[url="?m=mod_user&id=' . $rows['id'] . '"]modifica[/url][url="?m=user_del&id=' . $rows['id'] . '"]elimina[/url] [url="?m=appointment&id_utente=' . $rows['id'] . '"]crea appuntamento[/url][url="?m=user_appointment&id=' . $rows['id'] . '"]visualizza appuntamenti[/url]</td>';
echo $output;
}
}
if ($pagination) {
$output = '';
$counter = 1;
$num_link = 5;
$num_link = $num_pages < $num_link ? $num_pages : $num_link;
$from = isset($_GET['f']) ? (int)$_GET['f'] : 1;
$until = isset($_GET['u']) ? (int)$_GET['u'] : $num_link;
//prev link
if ($page == 1) {
$output .= '<< Prev ';
} elseif ($page != 1) {
if ($page == $from) {
$output .= '[url="?m=' . $m . '&title=' . $title . '&page=' . ($page - 1) . '&f=' . ($page - $num_link) . '&u=' . ($page - 1) . '"]<< Prev [/url]';
} else {
$output .= '[url="?m=' . $m . '&title=' . $title . '&page=' . ($page - 1) . '&f=' . $from . '&u=' . $until . '"]<< Prev[/url] ';
}
}
for ($i = $from; $i <= $until; $i++) {
if ($counter == 1) {
if ($page == $i) {
$output .= '' . $i . ' ';
} else {
$output .= '[url="?m=' . $m . '&title=' . $title . '&page=' . $i . '&f=' . $from . '&u=' . $until . '"]' . $i . '[/url] ';
}
} else {
if ($page == $i) {
$output .= '| ' . $i . ' ';
} else {
$output .= '| [url="?m=' . $m . '&title=' . $title . '&page=' . $i . '&f=' . $from . '&u=' . $until . '"]' . $i . '[/url] ';
}
}
$counter++;
}
//next link
if ($page < $num_pages) {
if ($page == $until) {
if (($num_pages - $page) >= $num_link) {
$output .= '[url="?m=' . $m . '&title=' . $title . '&page=' . ($page + 1) . '&f=' . ($page + 1) . '&u=' . ($page + $num_link) . '"]Next >>[/url]';
} else {
$until = $num_pages;
$output .= '[url="?m=' . $m . '&title=' . $title . '&page=' . ($page + 1) . '&f=' . ($page + 1) . '&u=' . $until . '"]Next >>[/url]';
}
} else {
$output .= '[url="?m=' . $m . '&title=' . $title . '&page=' . ($page + 1) . '&f=' . $from . '&u=' . $until . '"]Next >>[/url]';
}
} elseif ($page == $num_pages) {
$output .= 'Next >>';
}
echo '<tr><td colspan="5" class="vuoto">Total pages ' . $num_pages . '</td></tr>';
echo '<tr><td colspan="5" class="vuoto">' . $output . '</td></tr>';
}
?>
<table>
</div>
il pezzo dove devo intervenire, inserendo un altra colonna, suppongo sia questo:
Codice PHP:
<tr><th>Scheda N�</th><th>Nome</th><th>Cognome</th><th>Tel.</th><th>Email</th><th></th></tr>
<?php
while ($rows = mysql_fetch_array($res)) {
$output = '<tr><td>[url="?m=user_details&id=' . $rows['id'] . '"]' . sprintf('%010s', $rows['id']) . '[/url]</td><td>' . $rows['nome'] . '</td>';
$output .= '<td>' . $rows['cognome'] . '</td><td>' . $rows['telefono'] . '</td><td>[email="' . $rows['email'] . '"]' . $rows['email'] . '[/email]</td>';