tabledata.php
Beispiel eines Setup-Skriptes zur manipulation von Datenbankeinträgen
Das folgende Beispiel fügt 2 Datensätze in die Statistik-Tabelle:
<?php
/**
* This file is part of
* ALAF - PHP Framework System.
* Copyright by Andre Lachnicht www.alaniso.de
*
* @Revision: 0 @
* @Author: Andre Lachnicht @
* @Date: Tue 2017/12/30 16:22:00 CEST @
*/
// Datei vor Direktzugriff schützen:
defined ( 'alafMainFileLoaded' ) or die ( 'access denied' );
$ret_querys = array ();
// SYS_STAT_OBJECT ist eine Systemtabelle:
$table = af_get_dbsystablename ( "SYS_STAT_OBJECT" );
$mandt = af_base::get_afConfig ( 'mandt' );
$fields = array ();
$fields ['MANDT'] = $mandt;
$fields ['S_OBJECT'] = 'total';
$fields ['S_NAME'] = 'hits';
$fields ['S_ICON'] = '';
$fields ['S_COUNT'] = 0;
$db_row = af_DbGet ( $table, '*', [
'MANDT' => $fields ['MANDT'],
'S_OBJECT' => $fields ['S_OBJECT'],
'S_NAME' => $fields ['S_NAME']
] );
if (! $db_row) {
$ok = af_DbInsert ( $table, $fields );
$ret_querys [] = af_DbLastQuery ();
}
$fields = array ();
$fields ['MANDT'] = $mandt;
$fields ['S_OBJECT'] = 'reset';
$fields ['S_NAME'] = 'date';
$fields ['S_ICON'] = '';
$fields ['S_COUNT'] = time ();
$db_row = af_DbGet ( $table, '*', [
'MANDT' => $fields ['MANDT'],
'S_OBJECT' => $fields ['S_OBJECT'],
'S_NAME' => $fields ['S_NAME']
] );
if (! $db_row) {
$ok = af_DbInsert ( $table, $fields );
$ret_querys [] = af_DbLastQuery ();
}
?>
Last updated