editor-projects #29
51
dist/api/projectData.php
vendored
51
dist/api/projectData.php
vendored
@ -29,4 +29,55 @@ class projectData
|
|||||||
}
|
}
|
||||||
return array("errorMessage" => "Error, project data not found");
|
return array("errorMessage" => "Error, project data not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateProjectData(string $title, string $isMainProject, string $information, string $projectLink, string $githubLink, string $id): bool
|
||||||
|
{
|
||||||
|
$conn = dbConn();
|
||||||
|
$stmt = $conn->prepare("UPDATE projects SET title = :title, isMainProject = :isMainProject, information = :information, projectLink = :projectLink, githubLink = :githubLink WHERE ID = :id");
|
||||||
|
$stmt->bindParam(":title", $title);
|
||||||
|
$stmt->bindParam(":isMainProject", $isMainProject);
|
||||||
|
$stmt->bindParam(":information", $information);
|
||||||
|
$stmt->bindParam(":projectLink", $projectLink);
|
||||||
|
$stmt->bindParam(":githubLink", $githubLink);
|
||||||
|
$stmt->bindParam(":id", $id);
|
||||||
|
$stmt->execute();
|
||||||
|
|
||||||
|
if ($stmt->rowCount() > 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteProjectData(int $id): bool
|
||||||
|
{
|
||||||
|
$conn = dbConn();
|
||||||
|
$stmt = $conn->prepare("DELETE FROM projects WHERE ID = :id");
|
||||||
|
$stmt->bindParam(":id", $id);
|
||||||
|
$stmt->execute();
|
||||||
|
|
||||||
|
if ($stmt->rowCount() > 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function addProjectData(string $title, string $isMainProject, string $information, string $projectLink, string $githubLink): bool
|
||||||
|
{
|
||||||
|
$conn = dbConn();
|
||||||
|
$stmt = $conn->prepare("INSERT INTO projects (title, isMainProject, information, projectLink, githubLink) VALUES (:title, :isMainProject, :information, :projectLink, :githubLink)");
|
||||||
|
$stmt->bindParam(":title", $title);
|
||||||
|
$stmt->bindParam(":isMainProject", $isMainProject);
|
||||||
|
$stmt->bindParam(":information", $information);
|
||||||
|
$stmt->bindParam(":projectLink", $projectLink);
|
||||||
|
$stmt->bindParam(":githubLink", $githubLink);
|
||||||
|
$stmt->execute();
|
||||||
|
|
||||||
|
if ($stmt->rowCount() > 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user