Fixed small issues with projectData not being able to save uploaded image url to db

Signed-off-by: rodude123 <rodude123@gmail.com>
This commit is contained in:
Rohit Pai 2023-06-26 18:08:53 +01:00
parent 5ac8282fb6
commit 7d0317ed60
6 changed files with 12 additions and 10 deletions

View File

@ -173,7 +173,7 @@ class projectData
// update the database with the new image location
$conn = dbConn();
$stmt = $conn->prepare("UPDATE projects SET imgLocation = :imgLocation WHERE ID = :ID");
$stmt->bindParam(":imgLocation", $targetFile);
$stmt->bindParam(":imgLocation", $targetFile["imgLocation"]);
$stmt->bindParam(":ID", $ID);
$stmt->execute();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -173,7 +173,7 @@ class projectData
// update the database with the new image location
$conn = dbConn();
$stmt = $conn->prepare("UPDATE projects SET imgLocation = :imgLocation WHERE ID = :ID");
$stmt->bindParam(":imgLocation", $targetFile);
$stmt->bindParam(":imgLocation", $targetFile["imgLocation"]);
$stmt->bindParam(":ID", $ID);
$stmt->execute();

View File

@ -18,9 +18,10 @@
class="fa fa-caret-right"></i></a></li>
<li class="dropdown">
<ul>
<li><a href="#" id="goToAddPost" class="active"><span>&lt;</span>Add Blog Post<span>&gt;</span></a>
<li><a href="#" id="goToAddPost"><span>&lt;</span>Add Blog Post<span>&gt;</span></a>
</li>
<li><a href="#" id="goToEditPost"><span>&lt;</span>Edit Blog Post<span>&gt;</span></a></li>
<li><a href="#" id="goToEditPost" class="active"><span>&lt;</span>Edit Blog
Post<span>&gt;</span></a></li>
</ul>
</li>
<li><a href="#" id="logout"><span>&lt;</span>Logout<span>&gt;</span></a></li>
@ -205,6 +206,8 @@
<input type="submit" value="Add new blog post" class="btn btnPrimary boxShadowIn boxShadowOut">
</form>
</section>
</main>
<script src="js/editor.js"></script>

View File

@ -56,7 +56,7 @@ document.addEventListener('DOMContentLoaded', () =>
{
json.forEach(item =>
{
addProject(item["ID"], (item["isMainProject"] === "1" ? "true" : "false"), (item["imgLocation"] === "") ? "../imgs/placeholder.png" : item["imgLocation"], item["title"], item["information"], item["projectLink"], item["gitLink"]);
addProject(item["ID"], (item["isMainProject"] === 1 ? "true" : "false"), (item["imgLocation"] === "") ? "../imgs/placeholder.png" : item["imgLocation"], item["title"], item["information"], item["projectLink"], item["gitLink"]);
})
return;
}
@ -353,7 +353,6 @@ document.querySelector("#projError .close").addEventListener("click", () =>
document.querySelector("#addPostError .close").addEventListener("click", () =>
document.querySelector("#addPostError").classList.toggle("hidden"));
document.querySelector("#addPostSuccess .close").addEventListener("click", () =>
document.querySelector("#addPostSuccess").classList.toggle("hidden"));
@ -777,7 +776,7 @@ function updateProjectItem(id, e)
{
window.location.href = "./";
return;
}ujh
}
document.querySelector(`#projError${id}`).classList.remove("hidden");
document.querySelector(`#projError${id} div`).innerHTML = updatedProjectImage.error;
@ -856,7 +855,7 @@ function addProject(id , isMainProject, imgLocation, title, information, project
</div>
<div class="formControl isMainProject">
<label class="checkContainer" for="isMainProject${id}">Is It The Main Project
<input type="checkbox" id="isMainProject${id}" name="isMainProject${id}" ${(isMainProject === "true" ? "checked" : "")}>
<input type="checkbox" id="isMainProject${id}" name="isMainProject${id}" ${(isMainProject === "true" ? "checked=''" : "")}>
<span class="checkmark"></span>
</label>
</div>