06-04-2024

This commit is contained in:
2024-04-06 11:55:24 +02:00
parent f7c5cf7d47
commit 3d22f9c5d8
550 changed files with 27249 additions and 2537 deletions

71
test_sqlite/action.php Normal file
View File

@@ -0,0 +1,71 @@
<?php
//action.php
// id, filename, lens, legende, copyright, title,creator,keywords
//include('database_connection.php');
//print_r($_POST);
/*
*/
//$_POST['action'] = 'delete';
//$_POST['action'] = 'edit';
/*
$_POST["id"] = 179;
$_POST['lens'] = "";
$_POST['legende'] = "cso";
$_POST['copyright'] = "cso";
$_POST['title'] = "cso";
$_POST['creator'] = "";
$_POST['keywords'] = "";
*/
$conn = new PDO('sqlite:../db_photo.sqlite3');
if($_POST['action'] == 'edit') {
try {
$data = array(
':lens' => $_POST['lens'],
':legende' => $_POST['legende'],
':copyright' => $_POST['copyright'],
':title' => $_POST['title'],
':creator' => $_POST['creator'],
':keywords' => $_POST['keywords'],
':id' => $_POST['id']
);
$query = "
UPDATE photos
SET lens = :lens,
legende = :legende,
copyright = :copyright,
title = :title,
creator = :creator,
keywords = :keywords
WHERE id = :id
";
// echo $query;
// print_r($data);
$statement = $conn->prepare($query);
$statement->execute($data);
echo json_encode($_POST);
}
catch(PDOException $e) {
echo $e->getMessage();
}
}
if($_POST['action'] == 'delete') {
$query = "
DELETE FROM photos
WHERE id = '".$_POST["id"]."'
";
$statement = $conn->prepare($query);
$statement->execute();
echo json_encode($_POST);
}
?>