// assume there is a customer table with id, name and email columns $customerId = 123; $customer = Customer::findById($customerId); echo $customer->name; echo $customer->email;
// assume there is an order table with id, customer_id and product columns $orderNumber = 'ABCD1234'; $order = Order::findById($orderNumber); echo $order->product; echo $order->customer_id;The package library for the Model findById() method depends on the particular PHP framework or ORM (Object-Relational Mapping) tool being used. For example, the Laravel framework provides a built-in `find()` method to retrieve a record by ID. On the other hand, the PHP ActiveRecord library provides the `find_by_pk()` method to do the same.