'.mysql_error()); } mysql_select_db($mysql_database, $db) or die('Failed to select database
'.mysql_error()); $index = isset($_REQUEST['index']) ? mysql_real_escape_string($_REQUEST['index']) : 0; $action = isset($_REQUEST['action']) ? mysql_real_escape_string($_REQUEST['action']) : ''; if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($action == 'delete') { if (isset($_REQUEST['id'])) { $id = mysql_real_escape_string($_REQUEST['id']); $sql = "DELETE FROM " . $mysql_table . " WHERE id='$id'"; mysql_query($sql, $db) or die(mysql_error()); } mysql_close($db); exit; } else if ($action == 'save') { $id = isset($_REQUEST['id']) ? mysql_real_escape_string($_REQUEST['id']) : -1; if ($id >= 0) { $sql = "UPDATE " . $mysql_table . " SET WHERE `id` = '$id'"; mysql_query($sql, $db) or die(mysql_error()); } else { $sql = "INSERT " . $mysql_table . " () VALUES ()"; mysql_query($sql, $db) or die(mysql_error()); } echo 'Record saved'; mysql_close($db); exit; } } $total = 0; $sql = "SELECT COUNT(*) FROM " . $mysql_table; $result = mysql_query($sql, $db); if ($result) { $row = mysql_fetch_array($result); $total = $row[0]; } if ($action == 'prev') { $index--; if ($index < 0) $index = 0; } else if ($action == 'next') { $index++; if ($index >= $total) $index = $total-1; } else if ($action == 'first') { $index = 0; } else if ($action == 'last') { $index = $total-1; } else if ($action == 'new') { $index = -1; } if ($index >= 0 && $index < $total) { $sql = "SELECT * FROM " . $mysql_table . " LIMIT " . $index . ",1"; $result = mysql_query($sql, $db); if ($result) { $mysql_fields = mysql_fetch_array($result); } } else { $mysql_fields['id'] = -1; } mysql_close($db); if (session_id() == "") { session_start(); } require_once("mte.php"); ?> Безымянная страница
database = ''; $tabledit->host = ''; $tabledit->user = ''; $tabledit->pass = ''; $tabledit->table = ''; $tabledit->primary_key = ''; $tabledit->fields_in_list_view = array(); $tabledit->num_rows_list_view = 10; $tabledit->help_text = array(); $tabledit->show_text = array(); $tabledit->width_editor = '100%'; $tabledit->no_htaccess_warning = 'off'; $tabledit->database_connect(); $tabledit->do_it(); $tabledit->database_disconnect(); ?>