I need to retrieve data from two different tables, answers table and question table, i have managed to retrieve data of one table but i have faced a challenge to retrieve the second table data, do not get tired of me please anyone who can help me, below is how i have tried to do
Here is my view:
<table class="table table-hover">
<thead class="thead-dark">
<tr>
<th scope="col">Question No</th>
<th scope="col">Answer</th>
<th scope="col">Correct Answer</th>
<th scope="col">Marks</th>
</tr>
</thead>
<tbody>
<?php $i = 1; ?>
@foreach($results as $data)
<tr>
<td></td>
<td></td>
<td>
<td>
<td>
</tr>
@endforeach
</tbody>
</table>
Here is my controller
public function index()
{
$results = Answers::all();
$qns = Questions::all();
return view('test.result')
->with('results', $results)
->with('qns', $qns);
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire