==> Write a code which handles worst case input as well. - You have to take care before you start writing code
==> Handle unexpected situation in proper way ( ie. many tutorials of php to mysql - if db connection fails then they write die(), this is very bad - PFA ) You can redirect user to some page instead of calling die() & terminating page and give shocking surprise to your end user
==> If you need to repeat a code, never do it. Create separate user defined functions and then call them - In case in future you get to know that something makes your logic more correct - making that change will be very easy
