Fatal error: Uncaught Error: Call to undefined function mysql_connect()

后端 未结 8 668
一向
一向 2020-11-22 10:41

I am trying to do a simple connection with XAMPP and MySQL server, but whenever I try to enter data or connect to the database, I get this error.

Fata

相关标签:
8条回答
  • 2020-11-22 11:17

    Make sure you have not committed a typo as in my case

    msyql_fetch_assoc should be mysql

    0 讨论(0)
  • 2020-11-22 11:24

    As other answers suggest... Some guy (for whatever reason) decided that your old code should not work when you upgrade your PHP, because he knows better than you and don't care about what your code does or how simple it is for you to upgrade.

    Well, if you can't upgrade your project overnight you can

    downgrade your version of PHP to whatever version that worked

    or...

    use a shim (kind of polyfill) such as https://github.com/dshafik/php7-mysql-shim or https://github.com/dotpointer/mysql-shim, and then find a place for include_once("choice_shim.php"); somewhere in your code

    That will keep your old PHP code up and running until you are in a mood to update...

    0 讨论(0)
提交回复
热议问题