2006-10-20 23:31:37 +04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// retrieve all users and the phonenumber count for each user
|
|
|
|
|
|
|
|
$users = $conn->query("SELECT u.*, COUNT(p.id) count FROM User u, u.Phonenumber p GROUP BY u.id");
|
|
|
|
|
|
|
|
foreach($users as $user) {
|
2006-12-23 00:10:14 +03:00
|
|
|
print $user->name . ' has ' . $user->Phonenumber[0]->count . ' phonenumbers';
|
2006-10-20 23:31:37 +04:00
|
|
|
}
|
|
|
|
?>
|