I want foreach loop to execute only one time

The code is just wrong. I only want to print out the name of the logged in user but I don’t know how to do that.

Users Table

id
email
contributor
password
password_confirm
birthmonth
created

Mealplans Table

id
user_id
draggables
end_date
event_date
total_calories
created
modified