public function setLogo($content_filename, $type, $size) { $db = Database::getPDOConnection(); $f = fopen($content_filename, 'rb'); #$content = fread($f, filesize($content_filename)); #$content = mysqli::escape_string($content); $name = $db->quote($this->name); $stmt = $db->prepare("UPDATE series SET imgsize = ?, imgtype = ?, logo = ? WHERE name = {$name}"); $stmt->bindParam(1, $size, PDO::PARAM_INT); $stmt->bindParam(2, $type, PDO::PARAM_STR); $stmt->bindParam(3, $f, PDO::PARAM_LOB); #$stmt->bindParam(3, $this->name, PDO::PARAM_STR); $stmt->execute() or print_r($stmt->errorInfo()); fclose($f); }
function insertTrophy() { if ($_FILES['trophy']['size'] > 0) { $file = $_FILES['trophy']; $event = $_POST['name']; $name = $file['name']; $tmp = $file['tmp_name']; $size = $file['size']; $type = $file['type']; $f = fopen($tmp, 'rb'); $db = Database::getPDOConnection(); $stmt = $db->prepare("DELETE FROM trophies WHERE event = ?"); $stmt->bindParam(1, $event, PDO::PARAM_STR); $stmt->execute() or die($stmt->errorCode()); $stmt = $db->prepare("INSERT INTO trophies(event, size, type, image)\n VALUES(?, ?, ?, ?)"); $stmt->bindParam(1, $event, PDO::PARAM_STR); $stmt->bindParam(2, $size, PDO::PARAM_INT); $stmt->bindParam(3, $type, PDO::PARAM_STR); $stmt->bindParam(4, $f, PDO::PARAM_LOB); $stmt->execute() or die($stmt->errorCode()); fclose($f); return true; } }