ALAF-Framework
  • ALAF-Framework
  • Formular
    • button
    • input-Feld
      • alaf_currency input-Feld
      • checkbox input-Feld
      • checkboxes input-Feld
      • date input-Feld
      • signpad input-Feld
    • select Feld
    • staticField Feld
  • Optionale Parameter für input
  • Change-Checkbox
  • Setup
  • Modulstruktur
  • Beispiele
    • alaf_server_side.php
    • cleanup.files.php
    • get.config.php
    • tabledata.php
Powered by GitBook
On this page

Was this helpful?

  1. Beispiele

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 ();
}

?>
Previousget.config.php

Last updated 6 years ago

Was this helpful?