while($row = $result->fetch()){ $username = $row["name"]; // операции с $username }