Skip to content
Advertisement

SELECT COUNT with meekrodb Uncaught MeekroDBException

I would like to count the number of nums in a table from the associated idnr. However, I get the following error message: Fatal error: Uncaught MeekroDBException: If you use named args, you must pass an assoc array of args!

The table looks like this:

JavaScript

The SQL string:

JavaScript

And I want to show it like:

JavaScript

Thanks a lot 😉

Advertisement

Answer

Well, your error describes itself.

From the MeekroDB docs:

You can pass an array of named parameters and access them by name.

Example code:

JavaScript

So in your case it would be:

JavaScript

A few more notes:

  1. You should use SUM(), otherwise you’ll only rows count
  2. Since it’s an aggregating query which always returns a single row, use queryFirstRow instead of query
  3. YOu should define an alias for SUM(nums), so it will be easier to retrieve data from the result array.
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement