Init Commit
This commit is contained in:
28
fetch_block.php
Normal file
28
fetch_block.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
include 'connectDB.php';
|
||||
|
||||
$cvId = $_GET['cvId'];
|
||||
$tableName = $_GET['tableName'];
|
||||
|
||||
if ($tableName == 'profile'){
|
||||
// visible: 0-private; 1-public; 2-authentication
|
||||
$sql = "SELECT * FROM `profile` WHERE cid = $cvId AND (visible = 1 OR visible = 2)";
|
||||
}
|
||||
else{
|
||||
$sql = "SELECT * FROM `$tableName` WHERE owner = $cvId and visible = 1 GROUP BY (sequence)";
|
||||
}
|
||||
|
||||
$result = $conn->query($sql);
|
||||
$tableData = [];
|
||||
|
||||
if ($result->num_rows > 0) {
|
||||
// Loop through each row of the result set
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
// Add each row to the $tableData array
|
||||
$tableData[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode($tableData);
|
||||
$conn->close();
|
||||
?>
|
||||
Reference in New Issue
Block a user