0
<?php $results = DB::select('select * from insurance_policy where Id = ?', [1]);

                                           $row = $results->fetch_assoc();
                                            echo $row["Amount"];
                                  ?>

Here is my code it is giving me a error:Call to a member function fetch_assoc() on a non-object. I am using Laravel 5

1 Answers1

0

DB::select would return an Array which stores the DB rows. You can iterate the results

foreach ($results as $row) { echo $row['Amount']; }
Josh Crozier
  • 233,099
  • 56
  • 391
  • 304
limen
  • 67
  • 7