I've been forced to convert my website written for PHP 5 into 7.3. Say in the following (old) function:
function logMySQLError($err_line)
{
$err_no = @mysql_errno();
$err_desc = @mysql_error();
$err_time = date("n/j/Y, G:i:s", getLocalDateTimw());
postError("$err_time - MySQL #$err_no '$err_desc', line:$err_line");
}
That could be called throughout the website as such:
if(!$result)
{
logMySQLError(__LINE__);
}
Now in 7.3 I have to add 'i' to make this work ;) but then it also requires $link
parameter:
function logMySQLError($err_line)
{
$err_no = mysqli_errno(/* $link */);
$err_desc = mysqli_error(/* $link */);
$err_time = date("n/j/Y, G:i:s", getLocalDateTimw());
postError("$err_time - MySQL #$err_no '$err_desc', line:$err_line");
}
How do I get the last used $link
from the previous mysqli_connect
() call without passing it explicitly into this function? (Like it used to work.)