08-26-2016, 01:45 PM
//Retrieve complete user information by username, token or ID
function fetchUserDetails($username=NULL,$token=NULL, $id=NULL){
if($username!=NULL) {
$column = "username";
$data = $username;
}elseif($id!=NULL) {
$column = "id";
$data = $id;
}
$db = DB::getInstance();
$query = $db->query("SELECT * FROM users WHERE $column = $data LIMIT 1");
$results = $query->first();
return ($results);
}
how can i connect token to a user im trying to make userspice a backend to an app. something like restfulapi
function fetchUserDetails($username=NULL,$token=NULL, $id=NULL){
if($username!=NULL) {
$column = "username";
$data = $username;
}elseif($id!=NULL) {
$column = "id";
$data = $id;
}
$db = DB::getInstance();
$query = $db->query("SELECT * FROM users WHERE $column = $data LIMIT 1");
$results = $query->first();
return ($results);
}
how can i connect token to a user im trying to make userspice a backend to an app. something like restfulapi