<body>
<?php $results = mysql_query(
'SELECT * FROM customers ORDER BY name'
); ?>
<h2>Customers</h2>
<ul>
<?php while($customer = mysql_fetch_assoc($results)): ?>
<li><?php $customer['name'] ?></li>
<?php endwhile; ?>
</ul>
</body>
- to use this code requiring database
- You can not reuse any code unit independently
- this code can not test without browser
class UsersController {
public function indexAction() {
$repo = new UserRepository();
$users = $repo->getAll();
return $users;
}
}
- You can't use UsersController class without UserRepository class