I am making my first PHP project and it's now getting for me little uncomfortable. I want to update datasets in my database but when I execute the code nothing happens. First I tried to upload and refresh the site with:
header("location: Erfassen_Server.php");
Then I saw this Warning (The line 1029 is the line with header "location: Erfassen_Server.php" and the line 416 is just a row which really not can be the source of the problem):
Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\systemübersicht\Erfassen_Server.php:416) in C:\xampp\htdocs\systemübersicht\Erfassen_Server.php on line 1029
I have googled the reason, but could not find any useful information to solve the problem. So I had the idea to change the refresh part of the script to another code which does the same:
$secondsWait = 0; echo '<meta http-equiv="refresh" content="'.$secondsWait.'">';
Now everything looks good in PHP, I have no more error messages, but the datasets in my database are not updating. They do absolutely nothing. The site is refreshing with the not changed values. I have checked my update SQL command in the MySQL web interface with fixed values instead of variables and there it is working. I have also checked if all the variables are working, and they have as value the ID's which I need, therefor I would say this should be okay too.
Here is the SQL-Update statement:
UPDATE `system` Sys
JOIN service ON service.Servicename_ID = Sys.FK_Service_ID
JOIN Hardware ON Sys.System_ID = Hardware.FK_System_ID
JOIN Verantwortlichkeit ON Sys.System_ID = Verantwortlichkeit.FK_System_ID
JOIN system_zertifikat ON system_zertifikat.Zertifikate_ID = sys.Zertifikat
JOIN hardware_servername ON hardware.Servername = hardware_servername.Servername_ID
JOIN hardware_domaene ON hardware_domaene.Domaene_ID = hardware.Domaene
JOIN hardware_betriebssystem ON hardware_betriebssystem.Betriebssystem_ID = hardware.Betriebssystem
JOIN hardware_standort ON hardware_standort.Standort_ID = hardware.Standort
JOIN verantwortlichkeit_personen AS AA ON AA.Verantwortlichkeit_Personen_ID = sys.Hersteller
JOIN verantwortlichkeit_personen AS AB ON AB.Verantwortlichkeit_Personen_ID = sys.Externer_Partner
JOIN system_verfuegbarkeitsstufe ON system_verfuegbarkeitsstufe.Verfuegbarkeitsstufe_ID = sys.Verfuegbarkeitsstufe
JOIN system_systemname ON system_systemname.Systemname_ID = sys.Systemname
JOIN system_systemnummer ON system_systemnummer.Systemnummer_ID = sys.Systemnummer
JOIN verantwortlichkeit_rolle ON verantwortlichkeit_rolle.Verantwortlichkeit_Rolle_ID = verantwortlichkeit.Rolle
JOIN verantwortlichkeit_personen AS A0 ON A0.Verantwortlichkeit_Personen_ID = verantwortlichkeit.Hauptverantwortlicher
JOIN verantwortlichkeit_personen AS A1 ON A1.Verantwortlichkeit_Personen_ID = verantwortlichkeit.Stellvertretung
JOIN verantwortlichkeit_personen AS A2 ON A2.Verantwortlichkeit_Personen_ID = verantwortlichkeit.Wissenstraeger_1
JOIN verantwortlichkeit_personen AS A3 ON A3.Verantwortlichkeit_Personen_ID = verantwortlichkeit.Wissenstraeger_2
JOIN verantwortlichkeit_personen AS A4 ON A4.Verantwortlichkeit_Personen_ID = verantwortlichkeit.Verantwortlichkeit_extern
SET
Sys.Systemnummer = '$Systemnummer_ID',
Sys.Systembeschreibung = '$Systembeschreibung',
Sys.Hersteller = '$Hersteller_ID',
Sys.Externer_Partner = '$Externer_Partner_ID',
Sys.`BKAG_Brugg` = b'$BKAG_Brugg',
Sys.`BCIAG_Brugg` = b'$BCIAG_Brugg',
Sys.`Cables_Diverse_PL_CN_US_DE` = b'$Cables_Diverse',
Sys.`BINF` = b'$BINF',
Sys.`BRAG_Kleindoettingen` = b'$BRAG_Kleindoettingen',
Sys.`BRG_Wunstorf` = b'$BRG_Wunstorf',
Sys.`BGP_Nordhausen` = b'$BGP_Nordhausen',
Sys.`Pipes_Diverse_FR_PL_IT_US` = b'$Pipes_Diverse',
Sys.`Ropes_BDAG_Birr` = b'$Ropes_BDAG',
Sys.`HOLDING_Brugg` = b'$HOLDING_Brugg',
Sys.`BIAG_Brugg` = b'$BIAG_Brugg',
Sys.`BPK_Brugg` = b'$BPK_Brugg',
Sys.`Dritte_Schule_Brugg_LithCom_usw` = b'$Dritte',
Sys.`Verfuegbarkeitsstufe` = '$Verfuegbarkeitsstufe_ID',
Sys.`Datenverlust` = '$Datenverlust_ID',
Sys.`Systemname` = '$Systemname_ID',
Sys.`Zertifikat` = '$Zertifikat_ID',
hardware.`Servername` = '$Servername_ID',
hardware.`Domaene` = '$Domaene_ID',
hardware.`Betriebssystem` = '$Betriebssystem_ID',
hardware.`Lokale_Datenbank` = b'$Lokale_Datenbank',
hardware.`Datenbank_SQL_Master` = '$Datenbank_SQL_Master',
hardware.`Instanzname` = '$Instanzname',
hardware.`Standort` = '$Standort_ID',
hardware.`Backup_mit` = '$Backup_mit',
verantwortlichkeit.`Rolle` = '$Rolle_ID',
verantwortlichkeit.`Hauptverantwortlicher` = '$Hauptverantwortlicher_ID',
verantwortlichkeit.`Stellvertretung` = '$Stellvertretung_ID',
verantwortlichkeit.`Wissenstraeger_1` = '$Wissenstraeger_1_ID',
verantwortlichkeit.`Wissenstraeger_2` = '$Wissenstraeger_2_ID',
verantwortlichkeit.`Verantwortlichkeit_extern` = '$Verantwortlichkeit_Extern_ID'
WHERE Sys.System_ID = $System_ID"
I have spent really much time for finding the solution but can not find anything why it is not updating. Could it be that the new refresh solution has the same problem but is not giving any errors? Or am I overseeing something?
If someone could help me, I would be very thankful.