Hi,
Im coping my php code over from another host and im running into some issues.
I hope someone here can help me with.
I tried calling Godaddy phone support but he didnt understand what I was talking about.
So im trying to make a simple connection to mysql database which I have created on godaddy and uploaded the data. But the page displays this error when loaded.
Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /home/{USERNAME}/public_html/index4.php:8 Stack trace: #0 {main} thrown in /home/{USERNAME}/public_html/index4.php on line 8
I replaced GD username with{ USERNAME} for security reasons.
I wrote this code myself and its working on 4 other hosting companies servers without any problems at all.
This is my code. I replaced my details with {REMOVED} but they are correct.
$DBhost = "localhost"; // Host name
$DBuser = "{REMOVED}"; // Database user name
$DBpass = "{REMOVED}"; // Database password
$DBname = "{REMOVED}"; // Database name
mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database"); // this is LINE 8
mysql_select_db ($DBname);
Any suggestions?
Is mysql off? how can i find out.
Thanks
-D
Solved! Go to Solution.
The issue is you are now running PHP 7.x which mysql_connect has been removed - You need to use mysqli_connect - https://www.php.net/manual/en/function.mysqli-connect.php
Very similar syntax
Once your issue is resolved,
please be sure to come back and click accept for the solution
Get Better Support on the Community Boards!
Etiquette When Asking for Help from the Community
The issue is you are now running PHP 7.x which mysql_connect has been removed - You need to use mysqli_connect - https://www.php.net/manual/en/function.mysqli-connect.php
Very similar syntax
Once your issue is resolved,
please be sure to come back and click accept for the solution
Get Better Support on the Community Boards!
Etiquette When Asking for Help from the Community
OMG, thanks. But now it seems I have to go though over 50,000 lines of code.
Oh dear.