Skip to content

Instantly share code, notes, and snippets.

@ezra-g
Created January 12, 2012 18:29
Show Gist options
  • Save ezra-g/1602235 to your computer and use it in GitHub Desktop.
Save ezra-g/1602235 to your computer and use it in GitHub Desktop.
MariaDB [d6]> select * from votingapi_vote where content_id = 9;
+---------+--------------+------------+-------+------------+--------+-----+------------+-------------+
| vote_id | content_type | content_id | value | value_type | tag | uid | timestamp | vote_source |
+---------+--------------+------------+-------+------------+--------+-----+------------+-------------+
| 36 | node | 9 | 1 | points | idea | 3 | 1326121564 | ::1 |
| 37 | node | 9 | 1 | points | idea | 1 | 1326121565 | ::1 |
| 46 | node | 9 | 1 | points | points | 1 | 1326137013 | ::1 |
| 56 | node | 9 | -1 | points | points | 3 | 1326148550 | ::1 |
+---------+--------------+------------+-------+------------+--------+-----+------------+-------------+
4 rows in set (0.05 sec)
$criteria['content_id'] = 9;
$criteria['content_type'] = 'node';
$criteria['value_type'] = 'points';
$criteria['function'] = 'sum';
print_r(votingapi_select_single_result_value($criteria));
returns: 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment