<?php
session_start();
header('Content-Type: text/html; charset=UTF-8');

// Database credentials
$servername = "localhost";
$username = "parsaei_parsa";
$password = "fedrasion";
$dbname = "parsaei_techtip";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);

// Set the character set of the database connection
$conn->set_charset("utf8");

// Check connection
if ($conn->connect_error) {
  die("Connection failed: " . $conn->connect_error);
}

// Get the ID parameter from the URL
if (!isset($_GET['ID'])) {
  die("ID parameter not specified");
}

$id = $conn->real_escape_string($_GET['ID']);

// SQL query to retrieve the record with the specified ID
$query = "SELECT * FROM `TABLE 1` WHERE `COL 1` = '$id'";

// Execute the SQL query
$result = $conn->query($query);

if ($result->num_rows == 0) {
  die("Record not found");
}

$row = $result->fetch_assoc();
?>

<html>
<head>
<meta charset="UTF-8">
<title><?= $row['COL 5'] ?></title>
<style>
  body {
    font-family: Tahoma, sans-serif;
    font-size: 9pt;
  }
  table {
    border-collapse: collapse;
    margin: 20px 0;
  }
  th, td {
    padding: 10px;
    border: 1px solid #ccc;
  }
  th {
    background-color: #eee;
  }
</style>
</head>

<body dir="rtl">
  <table>
    <tr>
      <th>عنوان</th>
      <td><?= $row['COL 5'] ?></td>
    </tr>
    <tr>
      <th>محتوا</th>
      <td><?= $row['COL X'] ?></td>
    </tr>
  </table>
</body>
</html>
