The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Count by username
#2
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.

Code:
$taskQ = $db->query("SELECT utilizator FROM task WHERE utilizator = ?",array($permOp->lname));
Code:
$task_count = $taskQ->count();

I hope that helps.
  Reply


Messages In This Thread
Count by username - by picassoo - 11-26-2016, 09:59 AM
Count by username - by mudmin - 11-26-2016, 03:01 PM
Count by username - by picassoo - 11-26-2016, 05:15 PM
Count by username - by picassoo - 11-26-2016, 05:29 PM
Count by username - by mudmin - 11-26-2016, 06:41 PM
Count by username - by picassoo - 11-26-2016, 11:24 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)