0

Is it possible to get number of selected rows using Medoo? I havent found anything about it in the documentation.

Like num_rows() in mysqli or rowCount in pdo.

devbull
  • 227
  • 1
  • 4
  • 16
  • A little serach on google and here it goes : https://www.google.com/?gfe_rd=cr&ei=-8rqVIeZC6zj8wexroGgAg&gws_rd=cr#safe=active&q=medoo+row+count – Kheshav Sewnundun Feb 23 '15 at 10:01
  • Like I said, could not find any answers, thats why i am asking here, dont you think? – devbull Feb 23 '15 at 10:04
  • possible duplicate of [Count number of rows in SELECT query with PDO](http://stackoverflow.com/questions/6041886/count-number-of-rows-in-select-query-with-pdo) – david strachan Feb 23 '15 at 10:11

2 Answers2

0

Answered on official Github ticket #195

https://github.com/catfan/Medoo/issues/195

If you are using medoo->select you can use count to check the size of the returned array: http://php.net/manual/en/function.count.php

devbull
  • 227
  • 1
  • 4
  • 16
0

Use select count(ID) in your query

$query= "SELECT COUNT(id) FROM socialpic WHERE social_id=$eventid";

$database = new medoo();

$data = $database->query($query)->fetchAll();

so you will get $data in array... then you can count them with simple function.

$rowcount = count($data);