<?php

$db = mysqli_connect("192.168.178.253", "txl", "trixell", "txl");
if(!$db) die("Unable to connect to MySQL: " . mysqli_error($db));

$result = $db->query("SELECT * FROM falscheGXer");
while($row = $result->fetch_assoc()) {
	$_id = $row["id"];
	$_code = $row["pos4"];
	$_time = $row["zeitstempel"];

	$richtigerCode = str_replace("GX1", "GW1", $_code);

	echo "UPDATE KF480 SET pos4 = \"$richtigerCode\" WHERE ID = $_id AND pos4 = \"$_code\";";
	echo "UPDATE Bauteile SET TXLCode = \"$richtigerCode\" WHERE TXLCode = \"$_code\" AND zeitstempel = \"$_time\";\n";

	//echo "$_id: $_code / $_time\n";
}



?>