<?php
include('class.Users.php');
// count all users
$count = Users::doCount();
echo "COUNT " . $count;
// select all users
$userlist = Users::selectAll();
if ($userlist)
{
foreach($userlist as $user){
echo $user->toString();
// update the value of user
$user->setPassword("new password");
$user->update();
// delete the current user
$user->delete();
}
}else
{
echo "User has no data";
}
// insert a record
$user = new Users();
$user->setFirstname('Firstname');
$user->setLastname('Lastname');
$user->setUsername('Username');
$user->setPassword('Password');
$user->insert();
// retrieve the inserted user
$id = $user->getId();
$userload = Users::selectOne($id);
echo $userload->toString();
?>
|