'.$branch_id; } $frist_day = date('Y-m-d', strtotime($today)); $last_day = date("Y-m-t", strtotime($frist_day)); $data = array(); $inv_sql = ''; $get_bonds_sql = mysqli_query($db, "SELECT `emplyee`.`id`, `emplyee`.`name`, COUNT(`invoices_has_book`.`book_id`) AS `count` FROM `book_has_driver_for_points` INNER JOIN `invoices_has_book` ON `book_has_driver_for_points`.`book_id` = `invoices_has_book`.`book_id` INNER JOIN `emplyee` ON `emplyee`.`id` = `book_has_driver_for_points`.`emplyee_id` WHERE `book_has_driver_for_points`.`date_time` BETWEEN '$frist_day 00:00:00' AND '$last_day 23:59:59' GROUP BY `book_has_driver_for_points`.`emplyee_id` "); $data = array(); if (mysqli_num_rows($get_bonds_sql) > 0) { while ($get_bonds = mysqli_fetch_assoc($get_bonds_sql)) { $data[$get_bonds['id']] = array( 'name' => $get_bonds['name'], 'count' => $get_bonds['count'] ); } } ?>