Do not use mysql functions for your projects. it is already deprecated from PHP 5.5.0 and it will be removed in future version.
We can use mysqli functions if you are strict with mysql DB. This syntax not supports other DB.
PDO (PHP Data Objects)
Always, we should choose latest one. So that we are in the right direction. PDO is a latest approach to perform database operations which was introduced from PHP 5.
> It works through PDO drivers and currently it supports number of major databases (Mysql, Postgres, Sqllite..etc.,).
> You don’t need to change your syntax in code if you are planning to switch one DB to another DB
> You don’t need to write 2 different syntax’s if you are using 2 different DB in your projects
> I like to use prepared statement. So that we don’t care a bout SQL injection attacks. No need to filter every input using PHP functions. also, please check this topic “PDO right way to execute queries“