www/admin: format a few queries
This commit is contained in:
@@ -70,7 +70,12 @@ if ($start_date >= $stop_date) {
|
||||
|
||||
|
||||
if ($id == 0) {
|
||||
$query = 'INSERT INTO events (name, start, stop, organiser, location, description) VALUES (:title, :start, :stop, :organiser, :loc, :desc)';
|
||||
$query = '
|
||||
INSERT INTO
|
||||
events(name, start, stop, organiser, location, description)
|
||||
VALUES
|
||||
(:title, :start, :stop, :organiser, :loc, :desc)
|
||||
';
|
||||
$statement = $pdo->prepare($query);
|
||||
|
||||
$statement->bindParam(':title', $title, PDO::PARAM_STR);
|
||||
@@ -80,7 +85,19 @@ if ($id == 0) {
|
||||
$statement->bindParam(':organiser', $organiser, PDO::PARAM_STR);
|
||||
$statement->bindParam(':loc', $location, PDO::PARAM_STR);
|
||||
} else {
|
||||
$query = 'UPDATE events SET name=:title, start=:start, stop=:stop, organiser=:organiser, location=:loc, description=:desc WHERE id=:id';
|
||||
$query = '
|
||||
UPDATE
|
||||
events
|
||||
SET
|
||||
name = :title,
|
||||
start = :start,
|
||||
stop = :stop,
|
||||
organiser = :organiser,
|
||||
location = :loc,
|
||||
description = :desc
|
||||
WHERE
|
||||
id = :id
|
||||
';
|
||||
$statement = $pdo->prepare($query);
|
||||
|
||||
$statement->bindParam(':title', $title, PDO::PARAM_STR);
|
||||
|
||||
@@ -37,7 +37,12 @@ $active = ($_POST['active'] ?? false);
|
||||
|
||||
|
||||
if ($id == 0) {
|
||||
$query = 'INSERT INTO projects (name, description, active) VALUES (:title, :desc, :active)';
|
||||
$query = '
|
||||
INSERT INTO
|
||||
projects(name, description, active)
|
||||
VALUES
|
||||
(:title, :desc, :active)
|
||||
';
|
||||
$statement = $pdo->prepare($query);
|
||||
|
||||
$statement->bindParam(':title', $title, PDO::PARAM_STR);
|
||||
@@ -46,7 +51,12 @@ if ($id == 0) {
|
||||
|
||||
$statement->execute();
|
||||
|
||||
$ownerQuery = 'INSERT INTO projectmembers (projectid, name, uname, mail, role, lead, owner) VALUES (last_insert_rowid(), :owner, :owneruname, :owneremail, \'Prosjektleder\', 1, 1)';
|
||||
$ownerQuery = '
|
||||
INSERT INTO
|
||||
projectmembers(projectid, name, uname, mail, role, lead, owner)
|
||||
VALUES
|
||||
(last_insert_rowid(), :owner, :owneruname, :owneremail, \'Prosjektleder\', 1, 1)
|
||||
';
|
||||
$statement = $pdo->prepare($ownerQuery);
|
||||
$statement->bindParam(':owner', $name, PDO::PARAM_STR);
|
||||
$statement->bindParam(':owneruname', $uname, PDO::PARAM_STR);
|
||||
@@ -54,7 +64,16 @@ if ($id == 0) {
|
||||
|
||||
$statement->execute();
|
||||
} else {
|
||||
$query = 'UPDATE projects SET name=:title, description=:desc, active=:active WHERE id=:id';
|
||||
$query = '
|
||||
UPDATE
|
||||
projects
|
||||
SET
|
||||
name = :title,
|
||||
description = :desc,
|
||||
active = :active
|
||||
WHERE
|
||||
id = :id
|
||||
';
|
||||
$statement = $pdo->prepare($query);
|
||||
|
||||
$statement->bindParam(':title', $title, PDO::PARAM_STR);
|
||||
@@ -64,7 +83,14 @@ if ($id == 0) {
|
||||
|
||||
$statement->execute();
|
||||
|
||||
$query = 'UPDATE projectmembers SET name=:name, uname=:uname, mail=:mail';
|
||||
$query = '
|
||||
UPDATE
|
||||
projectmembers
|
||||
SET
|
||||
name = :name,
|
||||
uname = :uname,
|
||||
mail = :mail
|
||||
';
|
||||
$statement = $pdo->prepare($query);
|
||||
|
||||
$statement->bindParam(':name', $name, PDO::PARAM_STR);
|
||||
|
||||
Reference in New Issue
Block a user