commit cc4f814aa0a2d8bbeaa85f671dd5b43eb1082f0b
parent 4f87a35b53fa2f078db9b047e32978ed52f720e9
Author: MTRNord <mtrnord1@gmail.com>
Date: Fri, 20 Mar 2015 18:15:38 +0100
no it won't :D
Diffstat:
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/core/api/v1/DbHandler.class.php b/core/api/v1/DbHandler.class.php
@@ -247,9 +247,9 @@ class DbHandler {
$post["post_id_clean"] = $post_id_clean;
}
if ($post_id == NULL) {
- $x = 0;
+ $x = 1;
$id = 1;
- while ($x < $post_id_clean){
+ while ($x < $post_id_clean+1){
$stmt = $this->conn->prepare("SELECT id,title,text,author,category,date FROM posts WHERE id = ?");
$stmt->bind_param("i", $id);
@@ -267,7 +267,7 @@ class DbHandler {
$x = $x+1;
$id = $id+1;
}
- if ($id == $post_id_clean){
+ if ($id == $post_id_clean+1){
return $post;
}else{
return NULL;
diff --git a/core/api/v1/api.php b/core/api/v1/api.php
@@ -185,7 +185,7 @@ $app->get('/posts/', function() {
$result = $db->getPosts(NULL);
if ($result != NULL) {
$x = 1;
- $id = 1;
+ $id = 0;
while ($x < $result["post_id_clean"]+1){
$response["$id"]["error"] = false;