die kleine handliche web-basierte Notiz/Adress-Datenbank fuer php/mysql
This commit is contained in:
parent
0bffe48b4b
commit
c84e8b144f
26 changed files with 1363 additions and 0 deletions
49
notiz-datenbank/edit_notiz.php
Normal file
49
notiz-datenbank/edit_notiz.php
Normal file
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
- fuegt eine neue Notiz hinzu, bzw. veraendert eine Alte
|
||||
uebergeben wird: mensch_id, notiz_id, notiz
|
||||
falls notiz_id=-1 oder nicht gesetzt, dann neue Notiz anlegen
|
||||
- loescht eine Notiz
|
||||
*/
|
||||
|
||||
include_once("init.php");
|
||||
|
||||
|
||||
importPOST("notiz_id","submitNotizenliste","submitNotiz",
|
||||
"mensch_id","notiz");
|
||||
|
||||
if (!isset($notiz_id)) $notiz_id = -1;
|
||||
|
||||
|
||||
// 1. Fall: Auswahl eines Eintrags zur Korrektur
|
||||
if ($submitNotizenliste == " Bearbeiten ");
|
||||
// nichts tun, da email_id durch Formular bereits gesetzt wurde
|
||||
// 2. Fall: Loeschung
|
||||
if (($notiz_id > -1) AND ($submitNotizenliste == " Entfernen "))
|
||||
{
|
||||
mysql_query("DELETE FROM Notizen WHERE notiz_id='$notiz_id'")
|
||||
or die(holeSQLFehlerMeldung("Der Eintrag konnte nicht
|
||||
gelöscht werden!"));
|
||||
$notiz_id = -1;
|
||||
}
|
||||
// 3. Fall: Neue anlegen
|
||||
elseif (($notiz_id == -1) AND ($submitNotiz == "edit"))
|
||||
// eine Neue
|
||||
mysql_query("INSERT INTO Notizen (mensch_id,Notiz)
|
||||
VALUES('$mensch_id','$notiz')")
|
||||
or die(holeSQLFehlerMeldung("Die Notiz konnte
|
||||
nicht hinzugefügt werden!"));
|
||||
// 4. Fall: bestehende korrigieren
|
||||
elseif ($submitNotiz == "edit")
|
||||
{
|
||||
mysql_query("UPDATE Notizen SET Notiz='$notiz' " .
|
||||
"WHERE notiz_id='$notiz_id'")
|
||||
or die(holeSQLFehlerMeldung("Die Notiz konnte nicht " .
|
||||
"verändert werden!"));
|
||||
unset($notiz_id);
|
||||
}
|
||||
|
||||
include("zeige_mensch.php");
|
||||
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue