❓ 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
 

Similar threads

About this Thread

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

Trending Topics

Online now

Members online
328
Guests online
1,112
Total visitors
1,440

Forum statistics

Threads
2,273,069
Posts
28,947,380
Members
1,236,583
Latest member
ahamm
Back
Top