When you find a snippet of code, copy and paste that code into Notepad and save it as Cheat_Sheet.txt
Give each item a name the pertains to that snippet of code for easy reference. Example below.
##########################################
LINE FOR MySQL RESULT
####################
$str = "".$rec["content"]."";
echo nl2br($str);
##########################################
SET COOKIE
###########
setcookie('securelogin', $securelogin, time()+(606024*30), '/', '', 0);
##########################################
AUTH LINK AND REFRESH
########################
echo "<META HTTP-EQUIV='refresh' CONTENT='0; URL=your_page.php'>";
This will help you quite a bit for when you run into the same situation. No one can remember all this stuff. The brain does need to purge when you put to much in.