function inserter($redisql) { try { insert_worker($redisql); insert_customer($redisql); insert_employee($redisql); insert_division($redisql); insert_subdivision($redisql); insert_healthplan($redisql); insert_external($redisql); } catch (Exception $exception) { echo "EXCEPTION IN INSERTER: <br/>"; //echo "EXCEPTION IN INSERTER: " . $exception . "<br/>"; } }
<?php // require 'db_functions.php'; //Dodawanie danych do bazy danych if (isset($_POST['submit'])) { upload(); $firstname = $_POST['firstname']; $surname = $_POST['surname']; $branch = $_POST['branch']; $station = $_POST['station']; $salary = $_POST['salary']; $target_dir = "images/"; $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); insert_employee($db, $firstname, $surname, $branch, $station, $salary, $target_file); } //Wstawianie obrazka function upload() { $target_dir = "../images/"; $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); $uploadOk = 1; $imageFileType = pathinfo($target_file, PATHINFO_EXTENSION); // Check if image file is a actual image or fake image if (isset($_POST["submit"])) { $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]); if ($check !== false) { echo "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { echo "File is not an image.";