How to use primary key throughout multiple pages

Are there any videos of creators making their websites in this way. It is a lot simpler once I moved all of my server connects and data details over to my layout page, but I’m having trouble referencing the right ID when using my site. I posted in the How To with this question as well, but just want to see if you’d have any resources to help