<?php require_once "../classes/class.rdb.php"; require_once "../includes/constants.pagination.php"; require_once "../includes/functions.php"; require_once "../includes/layout.php"; $content = ""; $db = null; $messages = ""; $rows = 10; $self = $_SERVER["PHP_SELF"]; try { $db = new rdb("", "", "", true); } catch (Exception $e) { $messages = $e->getMessage(); if (empty($messages) === false) { die(sprintf(HTML_LAYOUT, $self, $messages)); } } try { for ($i = 0; $i < $rows; $i++) { $data = array(":" . KEY_NUMBER_DECIMAL => random_decimal(), ":" . KEY_NUMBER_INTEGER => random_integer(), ":" . KEY_STRING_SIXTYFOUR => random_string()); $id = $db->create(SQL_INSERT_RECORD, $data); } } catch (Exception $e) { $messages .= $e->getMessage(); } $content = sprintf(HTML_INSERT_HEADER, $rows); $messages = $db->dump_messages() . $messages; if (empty($messages) === false) { $content .= sprintf(HTML_PRE, $messages);
public static function dec_by_ids(array $keyvalues, array $ids) { return rdb::dec_by_ids(self::get_model_name(), $keyvalues, $ids); }
require_once "../classes/class.rdb.php"; require_once "../includes/constants.pagination.php"; require_once "../includes/functions.php"; require_once "../includes/layout.php"; $content = ""; $db = null; $messages = ""; $random_ids = array(); $records = array(); $rows = 10; $self = $_SERVER["PHP_SELF"]; $total_random_ids = 0; $total_rows = 0; try { $db = new rdb("", "", "", true); } catch (Exception $e) { $messages = $e->getMessage(); if (empty($messages) === false) { die(sprintf(HTML_LAYOUT, $self, $messages)); } } try { $records = $db->read(SQL_SELECT_RECORDS_ALL); $total_rows = count($records); if ($total_rows > $rows) { $random_ids = random_records($records, $rows); $total_random_ids = count($random_ids); if ($total_random_ids > 0) { foreach ($random_ids as $index => $random_id) { $data = array(":" . KEY_RANDOM_ID => $random_id);
require_once "../classes/class.pagination.php"; require_once "../classes/class.rdb.php"; require_once "../includes/layout.php"; $content = ""; $db = null; $messages = ""; $page = 1; $paginator = null; $records = array(); $row = 0; $rows_per_page = 10; $self = $_SERVER["PHP_SELF"]; $total_rows = 0; try { $db = new rdb("", "", "", true); } catch (Exception $e) { $messages = $e->getMessage(); if (empty($messages) === false) { die(sprintf(HTML_LAYOUT, $self, $messages)); } } try { $records = $db->read(SQL_SELECT_RECORDS_ALL); $total_rows = count($records); $paginator = new Pagination($page, $row, $rows_per_page, $total_rows, $self); $paginator->get_arguments(); $data = array(":" . KEY_BEGIN => $paginator->current_row, ":" . KEY_END => $paginator->rows_per_page); $records = $db->read(SQL_SELECT_RECORDS_PAGINATED, $data); $content = sprintf(HTML_PAGE_HEADER, $paginator->current_page, $paginator->last_page); $table_headers = sprintf(HTML_TABLE_TH_RIGHT, KEY_ID);