-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathverse-id.php
26 lines (21 loc) · 950 Bytes
/
verse-id.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
require_once "inc/connection.php"; // Include database connection file
require_once "inc/function.php"; // Include utility functions file
// Check if the request method is GET
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
// Check if the 'id' parameter is set in the query string
if (isset($_GET['id'])) {
$id = $_GET['id']; // Get and assign the 'id' parameter value
// Construct SQL query to fetch Ayah and Surah information
$query = "SELECT * FROM surahs JOIN ayahs ON surahs.id = ayahs.surah_id WHERE ayahs.id = $id";
// Call selectAyah function to execute the query and handle response
selectAyah($query);
} else {
// Handle case when 'id' parameter is not provided in the request
response_code(404, 'Not found id for ayah.');
}
} else {
// Handle case when request method is not GET
response_code(503, 'There is an error on request');
}
?>