11-26-2016, 06:41 PM
I can't tell exactly what you're trying to do, but it looks like you're missing one key part...how to get the utilizator into the function. So, I see three things...
1. You want to put your custom functions in usersc/includes/custom_functions.php . This way they will not get overwritten when we do updates. I do fix things and add functionality in both helpers.php and us_helpers.php and I wouldn't want you to miss those changes.
2. You need to pass the username into the function so you can do your query, so it should look like this...
Then everything else looks good.
Then when you run the function, you just do
That should point you in the right direction.
3. I will say that it is probably better technique to base this on the user's id instead of their name. This will allow their data to remain intact if they change their username because the id will not change.
1. You want to put your custom functions in usersc/includes/custom_functions.php . This way they will not get overwritten when we do updates. I do fix things and add functionality in both helpers.php and us_helpers.php and I wouldn't want you to miss those changes.
2. You need to pass the username into the function so you can do your query, so it should look like this...
Code:
function fetchAllTask($utilizator) {
Then everything else looks good.
Then when you run the function, you just do
Code:
fetchAllTask($user->data()->username);
That should point you in the right direction.
3. I will say that it is probably better technique to base this on the user's id instead of their name. This will allow their data to remain intact if they change their username because the id will not change.