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
main
cookie 18 years ago
parent 8f94dca624
commit 029b1be5f6

@ -2,31 +2,43 @@
if( !function_exists("db_query")) if( !function_exists("db_query"))
{ {
function Ausgabe_Daten($SQL) function db_querry_getDatenAssocArray($SQL)
{ {
global $con; global $con;
$Erg = mysql_query($SQL, $con); $Erg = mysql_query($SQL, $con);
echo mysql_error($con); echo mysql_error($con);
$Zeilen = mysql_num_rows($Erg); $Daten = array();
$Anzahl_Felder = mysql_num_fields($Erg); for( $i=0; $i<mysql_num_rows($Erg); $i++)
$Daten[$i] = mysql_fetch_assoc($Erg);
return $Daten;
}
function db_querry_diffDaten($Daten1, $Daten2)
{
$gefunden=False;
$Diff = "<table border=1>"; $Diff = "\n<table border=1>\n";
$Diff .= "<tr>"; $Diff .= "<tr>\n\t<th>Feldname</th>\n\t<th>old Value</th>\n\t<th>new Value</th>\n";
for ($m = 0 ; $m < $Anzahl_Felder ; $m++) $Diff .= "</tr>\n";
$Diff .= "<th>". mysql_field_name($Erg, $m). "</th>"; foreach($Daten1 as $DataKey => $Data1)
$Diff .= "</tr>";
for ($n = 0 ; $n < $Zeilen ; $n++)
{ {
$Diff .= "<tr>"; $Data2 = $Daten2[$DataKey];
for ($m = 0 ; $m < $Anzahl_Felder ; $m++) foreach($Data1 as $key => $value)
$Diff .= "<td>".mysql_result($Erg, $n, $m). "</td>"; if( $value != $Data2[$key])
$Diff .= "</tr>"; {
$Gefunden=TRUE;
$Diff .= "<tr>\n\t<td>$key</td>\n\t<td>$value</td>\n\t<td>".$Data2[$key]."</rd>\n</tr>";
}
} }
$Diff .= "</table>"; $Diff .= "</table>\n";
if( $Gefunden)
return $Diff; return $Diff;
else
return "\nno changes Fount\n";
} }
function db_query( $SQL, $comment) function db_query( $SQL, $comment)
@ -57,10 +69,10 @@ if( !function_exists("db_query"))
} }
else else
{ {
$Diff .= Ausgabe_Daten( "SELECT * FROM $Table $Where"); $Daten1 = db_querry_getDatenAssocArray( "SELECT * FROM $Table $Where");
//execute command
$querry_erg = mysql_query($SQL, $con); $querry_erg = mysql_query($SQL, $con);
$Diff .= Ausgabe_Daten( "SELECT * FROM $Table $Where"); $Daten2 = db_querry_getDatenAssocArray( "SELECT * FROM $Table $Where");
$Diff = db_querry_diffDaten($Daten1, $Daten2);
} }
} }
elseif( strpos( "#$SQL", "DELETE") > 0) elseif( strpos( "#$SQL", "DELETE") > 0)

Loading…
Cancel
Save