Fatal error: Call to undefined function mysql_connect() - PHP

I have uploaded the php files on new hosting and when I enter URL address into browser, I get this error:

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

The php files are working well on another server, so the code should be correct. Can you please give me suggestion what is wrong and how I have to fix it ?
posted on 19.01.2020 at 17:59
0pnshow more

There is probably a newer version of PHP on the server, which doesn't support mysql_connect() function. To open a connection to a MySQL Server instead of mysql_connect(), try to use mysqli_connect().

The mysqli_connect() function should look like:

mysqli_connect("localhost", "username", "password", "database");
posted on 24.01.2020 at 19:04
0pnshow more
share on facebookshare on twitter
2020 AnswerTabsTermsContact us
This site uses cookies to improve your experience, for analytics and ads. By continuing to browse this site you agree to our use of cookies.