cannot connect/find database on new server

metroedu

New member
We had to change to a new server. I ran all the old php 5.0 code through a php 7.4 editor using DZSoft. I made a number of corrections. However connecting to the database on the new server (which runs on php7.4) creates a fatal error. Here is the code I am using:
$conn = mysql_connect("localhost", "metrodmvdb", "password"");
however, this line produces an error:
Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /home/metrocourse/public_html/includes/conndb.inc:17 Stack trace: #0 /home/metrocourse/public_html/chkTs93Qgm834fP.php(60): require_once() #1 {main} thrown in /home/metrocourse/public_html/includes/conndb.inc on line 17
what is wrong with my single, simple line of code? godaddy has not a clue either!!!
I even changed the "localhost" to the database IP address. Made no difference at all!
Thanks for your help.
Juergen
 
Thank you for your reply!

You have pointed me in the right direction. You are correct, it should be mysqli_. Who would have thought a little "i" would make all the difference in the php world?

Forgive me but, I may have to ask about the "parameters" that go with _ collect. _errors etc.

Let me just say in the meantime, godaddy could not come up with an answer, but you could.

Thank your very much!

Juergen"
 
This is driving me crazy! Here is the code that is not working:

$conn = mysqli_connect("localhost", "metrodmvdb", "G3932gFtLIich");
$db_select = mysqli_select_db("metrodmvdb",$conn);

Warning: mysqli_select_db() expects parameter 1 to be mysqli, string given in /home/metrocourse/public_html/includes/conndb.inc on line 33

What is wrong with my code? Any help is very much appreciated!
Juergen
 
Check the procedural style:
https://www.php.net/manual/en/mysqli.select-db.php
Parameters order matters
 
Back
Top