0) { echo json_encode(array( "code" => 0, "message" => "OK", "data" => array( "id" => $row["id"], "title" => $row["title"], "author" => $row["author"], "from" => $row["from"] ) )); } else { echo json_encode(array( "code" => 1, "message" => "No results found", "data" => null )); } } else { echo json_encode(array( "code" => 2, "message" => "Error executing query", "data" => null )); }