❓ Help Paano Po gawin to nah Code

Dragon12

Enthusiast
Paano po to gawin nah push notiifcation po gamitin pero dapat pag mag push ako nang notification ito ang problema koh paano gawin toh nah pag may mag pah booking dapat mah notify yong admin at pag mag update nang status si admin ma notify din si user Paano po pa help huhuhu

function createNotification($user_id, $appointment_id, $status, $message) {
global $db;
PHP Code to Create Notifications
$query = "INSERT INTO notifications (user_id, appointment_id, status, message)
VALUES (?, ?, ?, ?)";

$stmt = $db->prepare($query);
$stmt->bind_param("iiss", $user_id, $appointment_id, $status, $message);
$stmt->execute();
}
AJAX Polling for Notifications
function checkNotifications() {
$.ajax({
url: 'get_notifications.php',
type: 'GET',
success: function(data) {
// Parse the response and show notifications
var notifications = JSON.parse(data);

notifications.forEach(function(notification) {
alert(notification.message); // Show notification to the user
});
}
});
}
 
try ko, wait

try this

file:

You do not have permission to view the full content of this post. Log in or register now.

php code pero simpler:

<?php
// Database connection (replace with your credentials)
$db = new mysqli('localhost', 'username', 'password', 'database');

// Function to create notifications
function createNotification($user_id, $appointment_id, $status, $message) {
global $db;
$query = "INSERT INTO notifications (user_id, appointment_id, status, message)
VALUES (?, ?, ?, ?)";
$stmt = $db->prepare($query);
$stmt->bind_param("iiss", $user_id, $appointment_id, $status, $message);
$stmt->execute();
}
?>

ajax polling:

function checkNotifications() {
$.ajax({
url: 'get_notifications.php', // The PHP file to get notifications
type: 'GET',
success: function(data) {
var notifications = JSON.parse(data); // Parse response

notifications.forEach(function(notification) {
alert(notification.message); // Show notification to the user
});
}
});
}

// Call this function every 10 seconds
setInterval(checkNotifications, 10000);
 
try ko, wait

try this

file:

You do not have permission to view the full content of this post. Log in or register now.

php code pero simpler:

<?php
// Database connection (replace with your credentials)
$db = new mysqli('localhost', 'username', 'password', 'database');

// Function to create notifications
function createNotification($user_id, $appointment_id, $status, $message) {
global $db;
$query = "INSERT INTO notifications (user_id, appointment_id, status, message)
VALUES (?, ?, ?, ?)";
$stmt = $db->prepare($query);
$stmt->bind_param("iiss", $user_id, $appointment_id, $status, $message);
$stmt->execute();
}
?>

ajax polling:

function checkNotifications() {
$.ajax({
url: 'get_notifications.php', // The PHP file to get notifications
type: 'GET',
success: function(data) {
var notifications = JSON.parse(data); // Parse response

notifications.forEach(function(notification) {
alert(notification.message); // Show notification to the user
});
}
});
}

// Call this function every 10 seconds
setInterval(checkNotifications, 10000);
salamat po sir
 

About this Thread

  • 2
    Replies
  • 337
    Views
  • 2
    Participants
Last reply from:
Dragon12

Trending Topics

Online now

Members online
1,262
Guests online
8,232
Total visitors
9,494

Forum statistics

Threads
2,329,440
Posts
29,248,278
Members
1,156,434
Latest member
olops_08
Back
Top