I think I get the OOP paradigm at its basic level, but it's hard for me to figure out how to look up records in the database correctly. I suspect this is because I really don't get OOP, as far as I think I'm doing ...
The application I'm trying to write is a shopping cart because it has a lot of good candidates for objects. The object I will work with is the product (yes, this is very primitive).
<?php
class Product
{
public $id = 0;
public $name = '';
public $price = 0;
function __construct($id)
{
}
}
$product = new Product();
echo $product->name;
?>
Simple enough. But now I want to find several products (for the search results page), and I'm not sure how to handle this.
, , SQL-, . . .
, , . , , , , . , , .
? - ?