Skip to content

Reading Data from Database

Niamul Hasan edited this page Jan 3, 2021 · 1 revision

Reading Data from database

Here in this way we can actually run query on database, Generally we'll be using this method to read data from database. If we want we can delete, insert and do others operation as well in this way. But there exists other methods for inserting and deleting data.

$data = DB::operation()->query('SELECT * from table');
print_r($data);

Here $data is our desired object. For, printing data in HTML code we can simply run a for each loop.

foreach($data as $row){
 echo $row->comumn_name;
 ccho $row->column_name2;
}
Clone this wiki locally