Here is the link. You need to register and login to view this page... You can use sample fake email id for it. Thnx :) I am using PHP SLIM framework to create API & the code is working fine on localhost but its giving following error on live
<b>Fatal error</b>: Uncaught Error: Call to undefined method mysqli_stmt::get_result() in /home/u474389745/public_html/php_slim/task_manager_angular/api2/include/DbHandler.php:338 Stack trace: #0 /home/u474389745/public_html/php_slim/task_manager_angular/api2/v1/index.php(175): DbHandler->getAllUserTasks(29) #1 [internal function]: {closure}() #2 /home/u474389745/public_html/php_slim/task_manager_angular/api2/libs/Slim/Route.php(436): call_user_func_array(Object(Closure), Array) #3 /home/u474389745/public_html/php_slim/task_manager_angular/api2/libs/Slim/Slim.php(1307): Slim\Route->dispatch() #4 /home/u474389745/public_html/php_slim/task_manager_angular/api2/libs/Slim/Middleware/Flash.php(85): Slim\Slim->call() #5 /home/u474389745/public_html/php_slim/task_manager_angular/api2/libs/Slim/Middleware/MethodOverride.php(92): Slim\Middleware\Flash->call() #6 /home/u474389745/public_html/php_slim/task_manager_angular/api2/libs/Slim/Middleware/PrettyExceptions.php(67): Slim\Middleware\MethodOverride->call() #7 /home/u474389745/public_h in <b>/home/u474389745/public_html/php_slim/task_manager_angular/api2/include/DbHandler.php</b> on line <b>338</b><br />
Below is my function call
$app->get('/tasks', 'authenticate', function() {
global $user_id;
$response = array();
$db = new DbHandler();
// fetching all user tasks
//line no 175 of index.php error detected by debug tool
$result = $db->getAllUserTasks($user_id);
$response["error"] = false;
$response["tasks"] = array();
// looping through result and preparing tasks array
while ($task = $result->fetch_assoc()) {
$tmp = array();
$tmp["id"] = $task["id"];
$tmp["task"] = $task["task"];
$tmp["status"] = $task["status"];
$tmp["createdAt"] = $task["created_at"];
array_push($response["tasks"], $tmp);
}
echoRespnse(200, $response);
});
And here i am fetching all data
public function getAllUserTasks($user_id) {
$stmt = $this->conn->prepare("SELECT t.* FROM tasks t, user_tasks ut WHERE t.id = ut.task_id AND ut.user_id = ?");
$stmt->bind_param("i", $user_id);
$stmt->execute();
//line no 338 in DbHandler.php error detected by debug tool
$tasks = $stmt->get_result();
$stmt->close();
return $tasks;
}
//in 338 line DbHandler.php $tasks = $stmt->get_result();
Please check angular function
$scope.get_all_task = function(add){
$http({
method: 'GET',
url: 'api2/v1/tasks',
crossDomain: true,
dataType: "json",
contentType: 'application/json',
headers: {'authorization': localStorage.getItem("login_api_angular"),'Content-Type': 'application/x-www-form-urlencoded'},
}).success(function (response, data, textStatus, jqXHR) {
console.log(response.tasks);
console.log(textStatus);
console.log(jqXHR);
$scope.task1 = response.tasks;
}).error(function (response, data, textStatus, jqXHR) {
console.log(response.message);
angular.element(document.getElementById('data_info_p')).append(response.message+' Please Login');
});
};
And this is html part
<table data-ng-controller="authCtrl" data-ng-init="get_all_task()" width="100%"><tbody id="data_info_p"><tr ng-repeat="task22 in task1">
<td>{{task22.task}}</td></tr></tbody></table>