I'm trying to use more OOP as I've typically always done procedural coding.
Right now, I've writing a page which will search a database based on some inputs and display a list of results.
In short, I have a page called cars.php within this page I have sliders to look at cost etc, it then uses AJAX to call get-cars-search.php
Within get-cars-search.php I have my SQL query and a loop for all results..
I guess my question is, should each result be defined as a new instance of an object 'Car' for example, or can I just echo them onto the page with some styling wrapped around it?
What's 'best practice' ??
while($row = $stmt->fetch(PDO::FETCH_OBJ)) {
var_dump($row);
}