add: einheitliche delete funktion
This commit is contained in:
		@@ -53,4 +53,21 @@ class BancaDati {
 | 
				
			|||||||
            die;
 | 
					            die;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Einheitliche Delete Funktion
 | 
				
			||||||
 | 
					     * @param string $table
 | 
				
			||||||
 | 
					     * @param string $id
 | 
				
			||||||
 | 
					     * @return void
 | 
				
			||||||
 | 
					     * @author Malte Schulze Hobeling
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function delete(string $table, string $id){
 | 
				
			||||||
 | 
					        $sql = "DELETE FROM " . $table . " WHERE `id` = " . $id . ";";
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            $sth = $this->pdo->prepare($sql);
 | 
				
			||||||
 | 
					            $sth->execute();
 | 
				
			||||||
 | 
					        }catch (\PDOException $e){
 | 
				
			||||||
 | 
					            die;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user