ZEKER WETEN?!?!

$value) { ?>

loadModule('Manager'); $fields = $db->listTableFields($_GET['table']); print_r($fields); exit; } function sql_browser_do_insert($db) { $schema = mdb2_all_assoc_rekey($db, "SELECT column_name, data_type FROM information_schema.columns WHERE table_name = '%q'", $_POST['table']); array_shift($schema); $cols = array(); $values = array(); foreach ($schema as $key => $value) { $cols[] = $key; if ($value == 'int') { if ($_POST[$key] == 'NULL') $values[] = 'NULL'; else $values[] = mdb2_printf($db, '%i', $_POST[$key]); } else $values[] = mdb2_printf($db, "'%q'", $_POST[$key]); } $query = 'INTO '.$_POST['table'].' ( '.implode(', ', $cols).' ) VALUES ( '.implode(', ', $values).' )'; //echo($query); //exit; sql_browser_execute_common($db, 'INSERT', $query); } function sql_browser_do_delete($db) { $query = 'FROM '.$_POST['table']. ' WHERE '.$_POST['where']; sql_browser_execute_common($db, 'DELETE', $query); } function sql_browser_do_update($db) { $schema = mdb2_all_assoc_rekey($db, "SELECT column_name, data_type FROM information_schema.columns WHERE table_name = '%q'", $_POST['table']); array_shift($schema); $set = array(); foreach ($schema as $key => $value) { if ($value == 'int') { if ($_POST[$key] == 'NULL') $set[] = $key.' = NULL'; else $set[] = mdb2_printf($db, $key.' = %i', $_POST[$key]); } else $set[] = mdb2_printf($db, $key." = '%q'", $_POST[$key]); } $query = $_POST['table'].' SET '.implode(', ', $set).' WHERE '.$_POST['where']; sql_browser_execute_common($db, 'UPDATE', $query); } function sql_browser_select($db) { global $concat_begin, $concat_cont, $concat_end, $as_varchar, $show_tables; $tables = mdb2_col($db, 0, $show_tables); $insert = ''; if (!isset($_GET['offset']) || $_GET['offset'] == '' || $_GET['offset'] < 0) $offset = 0; else $offset = $_GET['offset']; if (!isset($_GET['count']) || $_GET['count'] == '' || $_GET['count'] < 1) $count = 20; else $count = $_GET['count']; if (isset($_GET['select'])) { $query = $_GET['select']; if (preg_match('/\*( FROM ([[:alnum:]_]+)( WHERE .*)?( ORDER BY .*)?)$/', $query, $matches)) { $schema_res = mdb2_query($db, "SELECT column_name, data_type FROM information_schema.columns WHERE table_name = '%q'", $matches[2]); $row = $schema_res->fetchRow(MDB2_FETCHMODE_ASSOC); if ($row['data_type'] == 'int') { $update = ", $concat_begin 'wijz' $concat_end wijz, $concat_begin 'del' $concat_end del"; } else $update = ''; $insert = 'insert'; $query = '*'.$update.' '.$matches[1]; } if ($_GET['submit'] == '<') { $offset -= $_GET['count']; if ($offset < 0) $offset = 0; } else if ($_GET['submit'] == '>') $offset += $count; $db->setLimit($count, $offset); //echo('SELECT '.$query); $res = $db->query('SELECT '.$query); $errorInfo = $db->errorInfo($res); if (MDB2::isError($res)) error_user($res->getMessage(), $errorInfo[2].' SELECT '.$query, 'sql.php?mode=select&select='.urlencode($_GET['select'])); } html_start(); ?>

show rows starting from