I am using old code for a login process that accesses a local database. This is the first web project that I would like to put online. The code that I started with had deprecated functions so I've been trying to get everything up and running and gain an understanding of the language/process.
The original developers used a variable $link and two lines later they declare a global $$link. (EDIT: Since I first posted I learned about a variable variable, but I still fully understand this use case. What could it be used for)
tep_db_connect() or die('Unable to connect to database server!');
function tep_db_connect($server = DB_SERVER, $username = DB_SERVER_USERNAME, $password = DB_SERVER_PASSWORD, $database = DB_DATABASE, $link = 'db_link')
{
global $$link;
$$link = new mysqli($server, $username, $password);
if (!$$link) {
die("Connection Failed: " . $mysqli_connect_error());
}
mysqli_select_db($$link, $database);
return $$link;
}
This is my first web project. I'm used to using a debugger to figure things out.