nice to meet you all. I'm new to Python cgi and have a bit of experience with PHP. Using PHP I created a To do list program. After completing it I decided to write the same program with Python cgi to check how different it would be. But because I'm really new to Python I got stuck on basic knowledge on how to delete a row.
<?php
require_once 'init.php';
if(isset($_GET['item'])){
$id = $_GET['item'];
if(!empty($id)){
$deleteQuery = $db->prepare("
DELETE
FROM items
WHERE id=:id
");
$deleteQuery->execute([
'id' => $id
]);
}
};
header('Location:webPHP.php');
With PHP it is simple to retrieve a specific part of a row but how can I do it and confirm if it is not empty with Python?
cursor.fetchallis empty (ie,None) then you know rows you've designated in your SQL select do not exist.