<?php
include 'dbconnect.php';
$message ="Hello";
$sender_id = 1;
$receiver_id = 2;
$date = date('Y-m-d');

$query = "INSERT INTO messages(message,sender_id,receiver_id,timestamp) VALUES ('$message', '$sender_id','$receiver_id','$date')";
$result = pg_query($db, $query);
if (!$result) {
    // Handle query error
    die("Query failed: " . pg_last_error());
}

?>