From 029b1be5f638e48e0d521967d3bf70eb6b383612 Mon Sep 17 00:00:00 2001 From: cookie Date: Mon, 20 Nov 2006 22:59:30 +0000 Subject: [PATCH] es werden nur noch die aenderungen in die db geschrieben git-svn-id: svn://svn.cccv.de/engel-system@169 29ba0400-6e00-0410-a75a-ca02368028f8 --- www-ssl/inc/funktion_db.php | 60 ++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 24 deletions(-) diff --git a/www-ssl/inc/funktion_db.php b/www-ssl/inc/funktion_db.php index 6533c215..2975501b 100644 --- a/www-ssl/inc/funktion_db.php +++ b/www-ssl/inc/funktion_db.php @@ -2,33 +2,45 @@ if( !function_exists("db_query")) { - function Ausgabe_Daten($SQL) + function db_querry_getDatenAssocArray($SQL) { - global $con; - - + global $con; + $Erg = mysql_query($SQL, $con); echo mysql_error($con); - $Zeilen = mysql_num_rows($Erg); - $Anzahl_Felder = mysql_num_fields($Erg); + $Daten = array(); + for( $i=0; $i"; - $Diff .= ""; - for ($n = 0 ; $n < $Zeilen ; $n++) - { - $Diff .= ""; - for ($m = 0 ; $m < $Anzahl_Felder ; $m++) - $Diff .= "".mysql_result($Erg, $n, $m). ""; - $Diff .= ""; - } - $Diff .= ""; - return $Diff; + return $Daten; } + function db_querry_diffDaten($Daten1, $Daten2) + { + $gefunden=False; + + $Diff = "\n\n"; + $Diff .= "\n\t\n\t\n\t\n"; + $Diff .= "\n"; + foreach($Daten1 as $DataKey => $Data1) + { + $Data2 = $Daten2[$DataKey]; + foreach($Data1 as $key => $value) + if( $value != $Data2[$key]) + { + $Gefunden=TRUE; + $Diff .= "\n\t\n\t\n\t"; + } + } + $Diff .= "
Feldnameold Valuenew Value
$key$value".$Data2[$key]."\n
\n"; + + if( $Gefunden) + return $Diff; + else + return "\nno changes Fount\n"; + } + function db_query( $SQL, $comment) { global $con, $Page; @@ -57,10 +69,10 @@ if( !function_exists("db_query")) } else { - $Diff .= Ausgabe_Daten( "SELECT * FROM $Table $Where"); - //execute command - $querry_erg = mysql_query($SQL, $con); - $Diff .= Ausgabe_Daten( "SELECT * FROM $Table $Where"); + $Daten1 = db_querry_getDatenAssocArray( "SELECT * FROM $Table $Where"); + $querry_erg = mysql_query($SQL, $con); + $Daten2 = db_querry_getDatenAssocArray( "SELECT * FROM $Table $Where"); + $Diff = db_querry_diffDaten($Daten1, $Daten2); } } elseif( strpos( "#$SQL", "DELETE") > 0)