Bir php dosyası hazırladık.

1- Veritabanına bağlanıyor.
2- Belirli bir kullanıcıyı seçiyor.
3- Onlara bildirim gönderiyor.

Sistem Php 7.2'de kusursuz çalışıyor.

Ancak PHP 7.3'te çalışmıyor. Veritabanına bağlanıyor, kullanıcıları seçemiyor.

Sorun şurayla ilişkili = $sql = "select isadmin, pushtoken from users where isadmin=1"; (sorunu göstersin diye print yaptım 7.3 de onu da göstermiyor)

Kodu paylaşıyorum. Biri yardım edebilir mi?

<?php





$targetHost="xxxxx";




$servername = "localhost";
$username = "xxx";
$password = "xxxx";
$dbname = "xxxxx";




$conn = mysqli_connect($servername, $username, $password, $dbname);

if (!$conn) {
die("Database connection failed: " . $conn->connect_error);
}
echo "Database connected successfully" . "<br>";

function sendGCM($token) {

$data = [
"to" => $token,
"notification" =>
[
"title" => '🚨 COMPUTER CLOSED 🚨',
"body" => "Open the computer",
'default_sound' => true,
'sound' => "res/raw/notify.mp3",
'priority' => 'high'
],
];
$dataString = json_encode($data);

$headers = [
'Authorization: key=' . 'xxxxxx',
'Content-Type: application/json',
];

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://fcm.googleapis.com/fcm/send');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $dataString);

curl_exec($ch);
}

exec("ping -c 4 " . $targetHost, $output, $res);
print_r($output);
if ($res == 0) {
echo "Successfully got response from the server";
}


else{
$sql = "select isadmin, pushtoken from users where isadmin=1";
$result = mysqli_query($conn,$sql);
print_r($result);
if(mysqli_num_rows($result) > 0){
while($row = $result->fetch_assoc()) {
sendGCM($row["pushtoken"]);
echo "Notification sent!";
}
} else {
echo "0 admins found in database";
}
}
?>