06-04-2024
This commit is contained in:
53
editable-bootstrap-table/action.php
Normal file
53
editable-bootstrap-table/action.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
#include_once("inc/db_connect.php");
|
||||
|
||||
$conn = new PDO('sqlite:../db_photo.sqlite3');
|
||||
//$stmt = $conn->prepare($query);
|
||||
//$stmt->execute();
|
||||
|
||||
include 'functions.php';
|
||||
|
||||
_pr($_POST);
|
||||
// lens legende copyright title creator keywords
|
||||
|
||||
if ($_POST['action'] == 'edit' && $_POST['id']) {
|
||||
$updateField='';
|
||||
if(isset($_POST['lens'])) {
|
||||
$updateField.= "lens='".$_POST['lens']."'";
|
||||
} else if(isset($_POST['legende'])) {
|
||||
$updateField.= "legende='".$_POST['legende']."'";
|
||||
} else if(isset($_POST['copyright'])) {
|
||||
$updateField.= "copyright='".$_POST['copyright']."'";
|
||||
} else if(isset($_POST['title'])) {
|
||||
$updateField.= "title='".$_POST['title']."'";
|
||||
} else if(isset($_POST['creator'])) {
|
||||
$updateField.= "creator='".$_POST['creator']."'";
|
||||
} else if(isset($_POST['keywords'])) {
|
||||
$updateField.= "keywords='".$_POST['keywords']."'";
|
||||
}
|
||||
if($updateField && $_POST['id']) {
|
||||
$sqlQuery = "UPDATE photos SET $updateField WHERE id='" . $_POST['id'] . "'";
|
||||
echo $sqlQuery;
|
||||
/*
|
||||
mysqli_query($conn, $sqlQuery) or die("database error:". mysqli_error($conn));
|
||||
$data = array(
|
||||
"message" => "Record Updated",
|
||||
"status" => 1
|
||||
);
|
||||
echo json_encode($data);
|
||||
*/
|
||||
}
|
||||
}
|
||||
if ($_POST['action'] == 'delete' && $_POST['id']) {
|
||||
$sqlQuery = "DELETE FROM photos WHERE id='" . $_POST['id'] . "'";
|
||||
echo $sqlQuery;
|
||||
/*
|
||||
mysqli_query($conn, $sqlQuery) or die("database error:". mysqli_error($conn));
|
||||
$data = array(
|
||||
"message" => "Record Deleted",
|
||||
"status" => 1
|
||||
);
|
||||
echo json_encode($data);
|
||||
*/
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user