11-26-2016, 03:01 PM
You were really close. Two things.
1. You usually don't need DB:getInstance because it is already called in the header for you and only needs to be called once.
2. When you are putting variables in queries, you put a ? where the variable would usually go. The reason for this is that it forces the query to ONLY look in that one particular table/column. It's a bit tricky, but it's called binding if you want to look it up. So, this should be what you need.
I hope that helps.
1. You usually don't need DB:getInstance because it is already called in the header for you and only needs to be called once.
2. When you are putting variables in queries, you put a ? where the variable would usually go. The reason for this is that it forces the query to ONLY look in that one particular table/column. It's a bit tricky, but it's called binding if you want to look it up. So, this should be what you need.
Code:
$taskQ = $db->query("SELECT utilizator FROM task WHERE utilizator = ?",array($permOp->lname));
Code:
$task_count = $taskQ->count();
I hope that helps.