Check a mysql connection error

If your server cannot establish a connection with a webpage, you can check where is the problem with a code like the following:

<?php
$link = mysqli_connect("localhost", "user", "psw", "dbname");

/* check connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
}

if (!mysqli_query($link, "SET a=1")) {
    printf("Error message: %s\n", mysqli_error($link));
}

/* close connection */
mysqli_close($link);
?>

unblock linux update (attempted overwriting)

If an update is blocked because of an attempted overwriting problem, you can try to solve this problem by this code:

sudo dpkg -i --force-overwrite /var/cache/apt/ar
chives/your-package.deb

where your package could be something like libpipewire-0.3-modules_1.0.7-3~ubuntu22.04_amd64.deb