How to change the mysql in the following code to mysqli or PDO

Deprecated: mysql_connect (): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in / www/wwwroot/xcx.xxxxxx.com/phpwxpay/connect.php on line 11
ID order number, serial number, payment time

the background of the program prompts this paragraph

the corresponding file code is

header ("Content-type: text/html; charset=utf-8");
session_start ();

$host= "localhost";
$db_user= "sucaishui"; / / Database account
$db_pass= "123456"; / / Database password
$db_name= "xiaochengxu"; / / Database name

$timezone= "Asia/Shanghai";
$link=mysql_connect ($host,$db_user,$db_pass);
mysql_select_db ($db_name,$link);
mysql_query ("SET names UTF8");
header ("Content-Type: text/html; charset=utf-8");
date_default_timezone_set ($timezone); / / Beijing time
? >

)
Mar.09,2021

mysqli:

<?php

$timezone="Asia/Shanghai";
date_default_timezone_set($timezone);

$host="localhost";
$db_user="sucaishui";//
$db_pass="123456";//
$db_name="xiaochengxu";//

$dsn = "mysql:dbname={$db_name};host={$host}";

try {
    $db = new PDO($dsn, $db_user, $db_pass);
} catch (PDOException $e) {
    error_log('[][ ' . $e -> getMessage() . ' ]');
}
$db -> exec('SET NAMES utf8');

is it something like this?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e9a683-17d3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e9a683-17d3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?