The MySQL is officially depreciated and will be completely removed in php 7.
You can see the below given warning message in all posts of mysql functions in the php.net website.
This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, theMySQLi or PDO_MySQL extension should be used. See also MySQL: choosing an API guide andrelated FAQ for more information. Alternatives to this function include:
Here is the beautiful answer about this topic.
And to be honest, I suggest everyone to use mysqli’s Object Oriented Style and it will make your code and you smart. And Never stick to w3school’s procedural style as it might make you to think less