We are using str_replace to replace {$name} with $user['name'] from datebase, but its only replacing 1st entry of db, suppose there are 20 users, and 1st entry is 'tester' then it replace all {$name} with 1st entry only, check our code following...
foreach($users as $user) {
$content = str_replace('{$name}', $user['name'], $content);
$msg = '<div class="message">'.$content.'</div>';
}