Beispiel #1
0
/** @var string page_title */
$header->page_title = "Data Point";
/**
 * display the header
 */
$header->display_header();
/** @require functions file */
require_once "functions.php";
/** @require MySQL table edit class */
require_once "Vendor/MySQL_table_edit/mte.php";
/** @var string $data_table */
$data_table = $_GET["table"] != "" ? $_GET["table"] : $settings["data_view_default_table"];
/**
 * initate MySQLtabledit class
 */
$tabledit = new MySQLtabledit();
/** @var string table */
$tabledit->table = $data_table;
/**
 * get column comment from database to use as a name for the fields
 */
$query = "  SELECT COLUMN_NAME, COLUMN_COMMENT\n            FROM INFORMATION_SCHEMA.COLUMNS\n            WHERE table_name = '{$data_table}'";
$result = $mysqli->query($query) or write_log($mysqli->error, __FILE__, __LINE__);
$output = [];
$showt = [];
while ($column_obj = $result->fetch_object()) {
    $output[] = $column_obj->COLUMN_NAME;
    $showt[$column_obj->COLUMN_NAME] = $column_obj->COLUMN_COMMENT;
}
$result->close();
/** @var array links_to_db */
Beispiel #2
0
*  along with this program; if not, write to the Free Software
*  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
*/
/**
 * Data point
 *
 * @author Mauri Kujala <*****@*****.**>
 * @copyright Copyright (C) 2016, Mauri Kujala
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
*/
session_start();
$pagetitle = "Data Point";
require_once "" . $_SERVER["DOCUMENT_ROOT"] . "/style/header.php";
require_once "" . $_SERVER["DOCUMENT_ROOT"] . "/source/Vendor/MySQL_table_edit/mte.php";
$data_table = $_GET["table"] != "" ? $_GET["table"] : $settings['data_view_default_table'];
$tabledit = new MySQLtabledit();
// database settings:
$tabledit->database = $db;
$tabledit->host = $server;
$tabledit->user = $user;
$tabledit->pass = $pwd;
$tabledit->database_connect();
$tabledit->table = $data_table;
$colres = mysqli_query($GLOBALS["___mysqli_ston"], "\tSELECT COLUMN_NAME, COLUMN_COMMENT\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM INFORMATION_SCHEMA.COLUMNS\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE table_name = '" . $data_table . "'");
$output = array();
$showt = array();
while ($colarr = mysqli_fetch_assoc($colres)) {
    $output[] = $colarr['COLUMN_NAME'];
    $showt[$colarr['COLUMN_NAME']] = $colarr['COLUMN_COMMENT'];
}
$tabledit->links_to_db = $settings['data_view_table'];