Cancellazione non effettuata!



"; } } if (isset ($aggiorna)) { if (isset($tbl)) { $criteri = "SELECT * FROM $tbl "; $result = mysql_query($criteri, $db); $myrow = mysql_fetch_array($result); $num_fields = mysql_num_fields($result); $query = "UPDATE $tbl SET "; for($x = 0; $x < $num_fields-1; $x++) $query .= " ".mysql_field_name($result, $x)." = '".$valori[mysql_field_name($result, $x)]."',"; $query .= " ".mysql_field_name($result, $num_fields-1)." = '".$valori[mysql_field_name($result, $num_fields-1)]."'"; $query .= " WHERE id = $id "; //echo $query; $agg = mysql_query($query, $db); if (!$agg) echo "

Aggiornamento non effettuato!



"; } } if (isset ($salva)) { if (isset($tbl)) { $criteri = "SELECT * FROM $tbl "; $result = mysql_query($criteri, $db); $myrow = mysql_fetch_array($result); $num_fields = mysql_num_fields($result); $query = "INSERT INTO $tbl ("; for($x = 0; $x < $num_fields-1; $x++) $query .= " ".mysql_field_name($result, $x).","; $query .= " ".mysql_field_name($result, $num_fields-1).""; $query .= ") VALUES ( "; for($x = 0; $x < $num_fields-1; $x++) $query .= " '".$valori[mysql_field_name($result, $x)]."',"; $query .= " '".$valori[mysql_field_name($result, $x)]."')"; //echo $query; $sal = mysql_query($query, $db); if (!$sal) echo "

Salvataggio non riuscito!



"; } } //if ($mostra == 'deletesicuro') if ($mostra == 'mod') { if (isset($tbl)) { echo "

Aggiornamento dati

"; if (isset($id)) $criteri = "SELECT * FROM $tbl WHERE id = $id "; else $criteri = "SELECT * FROM $tbl "; //echo $criteri; $result = mysql_query($criteri, $db); $myrow = mysql_fetch_array($result); $num_fields = mysql_num_fields($result); echo "
"; //$valori = array(); for($x = 0; $x < $num_fields; $x++) { //$tipo = ""; // Visualizza il tipo del campo $dati = ""; $t = ereg_replace("'", "", $myrow[mysql_field_name($result, $x)]); // Rimozione delle stringhe del singolo apice if (isset($id)) $dati = $t; if ($riga == true) { echo ""; $riga = false; } else { echo ""; $riga = true; } if (mysql_field_type($result, $x) == "blob") //if (mysql_field_type($result, $x) == "blob" || mysql_field_len($result, $x) > 30 ) echo "$tipo"; else echo "$tipo"; } echo ""; echo ""; else echo ""; echo "
".mysql_field_type($result, $x)."
".mysql_field_name($result, $x)."
".mysql_field_name($result, $x)."

"; if (isset($id)) echo "
"; } } elseif ($mostra == 'delete') { echo "
La tabella '$tbl' verrá vuotata. Proseguire?"; echo "
 "; echo "
"; } else { if ($drop == "SI") { if (isset($tbl)) { $query = "DELETE FROM $tbl "; //echo $query; $del = mysql_query($query, $db); if (!$del) echo "

Cancellazione non riuscita!



"; } } if (isset($tbl)) { if (isset($links_shown1)) $links_shown = $links_shown1; if (isset($links_shown_p1)) $links_shown = $links_shown_p1; $row_max = 30; // Numero di righe per pagina if (!$links_shown) $links_shown = 0; else $old_link = $links_shown; echo "

Tabella: $tbl

"; $sql = "SELECT count(*) as conto FROM $tbl"; if (isset($total_result) == false) { $result1 = mysql_query($sql,$db); $myrow1 = mysql_fetch_array($result1); $total_result = $myrow1["conto"]; } $criteri = "SELECT * FROM $tbl limit $links_shown, $row_max"; //echo $criteri; $result = mysql_query($criteri, $db); $myrow = mysql_fetch_array($result); $dati = array(); $num_fields = mysql_num_fields($result); //echo $total_result; if ($total_result > 0) { for($x = 0; $x < $num_fields; $x++) $dati[] = mysql_field_name($result, $x); $table = array(); do { $temp = array(); foreach($dati as $nome) $temp[] = $myrow[$nome]; array_push($table,$temp); }while ($myrow = mysql_fetch_array($result)); echo ""; echo ""; foreach($dati as $headers) echo ""; echo ""; foreach($table as $y) { if ($riga == true) { echo ""; $riga = false; } else { echo ""; $riga = true; } foreach($y as $xcell) { if ($xcell != "") echo ""; else echo ""; } //echo ""; //echo ""; //echo ""; echo ""; echo ""; } echo ""; } else { echo "
$headers

$xcell
ModificaCancella
ModificaCancella
ModificaElimina

Vuota la tabella
"; } $links_shown = $links_shown + $row_max; echo ""; echo "
La Tabella non contiene record

Aggiungi nuovo record
"; $links_shown = $links_shown - 1; if (($links_shown + 1) != $row_max) { $links_on_this_page = $links_shown - $old_link; $links_shown_prev = $links_shown - (($row_max + $links_on_this_page)); } if ($links_shown != ($total_result-1)) $links_shown = ($links_shown + 1); echo ""; if ($total_result > $row_max) { if (isset($links_shown_prev)==true) echo ""; echo ""; //if ($links_shown!=$total_result-1) if ($links_shown < ($total_result - 1)) echo ""; echo "
Precedente
Successivo
"; } } } //echo "

Torna

"; ?>