Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

How do I output top readers from MySql table

//here we loaded students as well as we need to know the name
//and then group by `student_id`

$book_issues = book_issue::with('student')
->where('issue_date', 'LIKE', '%' . $request->month . '%')
->get()
->groupBy('student_id');

$row = 1;
@foreach($book_issues as $k => $v)
    <tr>
        <td>{{$row}}</td>
        <td>{{$v->first()->student->name}}</td>
        <td>{{$$v->count()}}</td>
    </tr>
    <?php 
        $row++;
    ?>
@endforeach
 
PREVIOUS NEXT
Tagged: #How #I #output #top #readers #MySql #table
ADD COMMENT
Topic
Name
3+5 =