我可以同时包含MySQL和MySQLi数据库连接文件吗?

Hey have coded all my site with mysqli. But most of the scripts I found from GitHub or other such sites are coded with mysql.

So, when am implementing that in my projects should i replace the mysql with mysqli or can i use both of them in my connection files and all other PHP files??

There is nothing stopping you from using both, but were I you I would choose one type of connection and go along with it. Mixing can be confusing not only for other people who read your code but also your future self.

You can use both of them. However this does not mean you should. You should not use 2 connections. For multiple reasons:

  • Mysql is deprecated as of PHP 5.5.0, and will be removed in the future..
  • Multiple database connections and more files which means performance issues.
  • It's very confusing to work with 2 different connections while it's not needed at all.