Try this use your desired name for function names :
function main_func_name() {
//Date parameter
$currentDay = date('j');
$currentMonth = date('n');
//wp query to show saints name
$con = mysqli_connect("localhost", "mydb", "mypassword", "myuser");
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$sql = "select * from santi where numero_giorno= " . $currentDay . " and numero_mese= " . $currentMonth;
$result = mysqli_query($con, $sql);
if (mysqli_affected_rows($con) > 0) {
while ($row = $result->fetch_assoc()) {
?>
<span id="txtSaintName"><?php echo $row['nome'] ?></span>
<?php
}
mysqli_close($con);
}
}
add_shortcode('shortcode_name', 'function_shortcode');
function function_shortcode() {
ob_start();
main_func_name();
return ob_get_clean();
}
?>