PHP or Hypertext Preprocessor is undoubtedly the most used programming language in the contemporary time. The so called server-side scripting language is so versatile that it blends in easily with HTML code, templating engines and even web frameworks. One of the characteristic features that make PHP a popular scripting language is the easiness with which one can digest it and write functional codes. The fact that you can easily learn PHP and start writing functional codes, doesn’t imply that you can start developing quality databases right away, you still need to invest some time and efforts to achieve such goals. As a developer who is novice to PHP scripting, you are bound to make many mistakes, I would like to point out some common mistakes made by novice PHP developers.
Database Engine Selection
Wrong Database Engine Selection is literally a MySQL mistake made by PHP developers. As a matter of fact, there are several database engines tagged with MySQL like federated, NDB, InnoDB, MyISAM however, two of the prominent ones that you are certain to come across are MyISAM and InnoDB. Supported with almost all the MySQL configuration, MyISAM seems to be the perfect choice on most of the occasions, however, InnoDB which comes tagged with several attractive features like crash recovery; rollback etc is the ideal choice. Foreign key constraints or transactions which turn out to be an essentiality when it comes to data integrity are not compatible with MyISAM.
*select usage in queries
Using * is one of the easiest and prominent means to return or retrieve all the columns in a table. However, it is always advised to explicitly sort out the columns you want to retrieve. Specifying the columns to be returned can also help you to fetch results at a much faster rate thereby enhancing end-user experience.
Avoiding database caching
As a PHP novice, one of the mistakes that you are bound to make is to forget/avoid database caching. When a web/ mobile app comes across few queries, the time taken to return results from respective database tables is less, however, when the same web/mobile app is making a thousand plus queries simultaneously, it can result in slower page loading which in turn can generate a horrible end user experience. Using a database caching software like Memcached can easily help you to mitigate the seriousness of such issues.
Saving password as a string
One of the silly mistakes that you can make while coding in PHP is that you tend to save passwords as strings. Any password saved as a string can be easily hacked via some SQL injections. It is highly advised that you use any encryption algorithm to secure your password, you can always save it as MD5 which is irreversible. By storing the password as MD5, you are literally protecting it from other programmers as well.
Using dynamic URLs
Static URLs are considered to be one of the essentialities related to website optimization when it comes to making your website a standout one among your competitors in the perspective of any search engines. Even though static URL’s are considered to be minor signals in website ranking, they are really important when you sack-in aspects like end-user experience. Almost every framework in the contemporary time come with a standard guide to making URL’s search engine friendly. It’s just that the novice programmers are too lazy or ignorant to follow these guidelines.
PHP is undoubtedly an easy language to master, I believe that the above highlighted coding etiquette will certainly help any individual with the flame to learn PHP to become a respective professional with ease.