bu2chlc

psuedo code for crud operations

Oct 11th, 2020
3,498
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.48 KB | None | 0 0
  1. <?php
  2. if ($_SERVER['REQUEST_METHOD'] === 'POST') {
  3.  
  4.     // send with $_POST['action'] a variable called ID
  5.     if ($_POST['action'] === 'delete'){
  6.         delete record where id= $_POST['id'];
  7.     }
  8.  
  9.     if ($_POST['action'] === 'create'){
  10.         create record with $_POST['fields'];
  11.     }
  12.  
  13.     if ($_POST['action'] === 'update'){
  14.         update record where id= $_POST['id'];
  15.     }
  16.  
  17.     if ($_POST['action'] === 'read'){
  18.         select record where id= $_POST['id'];
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment