commit 925f9a7beeeb6b66d8a68c043efdac4a58ed675f
parent 9ed26ce7cc269e3500747d31a808d027ae87f229
Author: MTRNord <mtrnord1@gmail.com>
Date: Fri, 20 Mar 2015 17:53:58 +0100
next try
Diffstat:
1 file changed, 17 insertions(+), 20 deletions(-)
diff --git a/core/api/v1/DbHandler.class.php b/core/api/v1/DbHandler.class.php
@@ -249,33 +249,30 @@ class DbHandler {
$x = 1;
$id = 1;
while ($x < $post_id_clean+1){
- echo $x;
- echo "</br>";
- echo $id;
- echo "</br>";
- echo $post_id_clean;
- echo "</br>";
$stmt = $this->conn->prepare("SELECT id,title,text,author,category,date FROM posts WHERE id = ?");
$stmt->bind_param("i", $id);
- $test = is_int($x);
- echo $test;
- echo "</br>";
+
$x = $x+1;
- echo $x;
$id = $id+1;
if ($stmt->execute()) {
- $post["$x"] = $stmt->get_result()->fetch_assoc();
- if ($post["$x"]["text"] != NULL){
- $post["$x"]["text"] = html_entity_decode($post["text"]);
- }else{
- $post["$x"] = NULL;
- }
- $stmt->close();
- return $post;
- } else {
- return NULL;
+ $post["$x"] = $stmt->get_result()->fetch_assoc();
+
+ if ($post["$x"]["text"] != NULL){
+ $post["$x"]["text"] = html_entity_decode($post["text"]);
+ }else{
+ $post["$x"] = NULL;
+ }
+ $stmt->close();
+
}
}
+
+ if ($stmt->execute()){
+ return $post;
+ }else{
+ return NULL;
+ }
+
}else{
$stmt = $this->conn->prepare("SELECT id,title,text,author,category,date FROM posts WHERE id = ?");
$stmt->bind_param("i", $post_id);