Fatal error Call to undefined function mysql connect

0 votes

I have set up PHP, MySQL, and Apache. localhost() for PHP and it is working well. But after I downloaded MySQL, it reports:

Fatal error: Call to undefined function mysql_connect()

How can I fix this?

Nov 23, 2020 in PHP by kartik
• 37,520 points
3,543 views

1 answer to this question.

0 votes

Hello @kartik,

You upgraded to PHP 7, and now mysql_connect is deprecated. Check yours with:

php -version

Change it to mysqli_connect as in:

$host = "127.0.0.1";
$username = "root";
$pass = "foobar";
$con = mysqli_connect($host, $username, $pass, "your_database");

If you're upgrading legacy PHP, now you're faced with the task of upgrading all your mysql_* functions with mysqli_* functions.

answered Nov 23, 2020 by Niroj
• 82,840 points

Related Questions In PHP

0 votes
1 answer

Fatal error: Call to undefined function ImageCreate() in /home/t1g01/phplot.php on line 248

Hello @kartik, Your server most like does not ...READ MORE

answered Nov 18, 2020 in PHP by Niroj
• 82,840 points
6,293 views
0 votes
0 answers
0 votes
1 answer

Error: Call to undefined function money_format()

Hello @kartik, If you are using windows based ...READ MORE

answered Nov 16, 2020 in PHP by Niroj
• 82,840 points
2,824 views
0 votes
1 answer

Error: Global Variable is not accessable to local function

Hey kartik, A variable declared outside a function has a ...READ MORE

answered Feb 19, 2020 in PHP by Niroj
• 82,840 points
1,108 views
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
23,087 views
0 votes
1 answer

What is redirection in Laravel?

Named route is used to give specific ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
3,017 views
0 votes
1 answer

How to install Laravel via composer?

Hello, This is simple you just need to ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,840 points
2,951 views
+1 vote
1 answer

What are named routes in Laravel and How can specify route names for controller actions?

Hey @kartik, Named routing is another amazing feature of ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,840 points
44,894 views
0 votes
1 answer

Fatal error: Call to undefined function imap_open() in PHP

Hello @kartik, In Ubuntu for install imap use sudo ...READ MORE

answered Oct 29, 2020 in PHP by Niroj
• 82,840 points
5,695 views
0 votes
1 answer

Fatal error: Call to undefined function socket_create()

Hello @kartik, For a typical XAMPP install on ...READ MORE

answered Nov 3, 2020 in PHP by Niroj
• 82,840 points
6,769 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP