PHP Classes

File: api/edituser-api.php

Recommend this page to a friend!
  Classes of Adeleye Ayodeji   Simple REST API   api/edituser-api.php   Download  
File: api/edituser-api.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Simple REST API
Example of REST API using the MVC design pattern
Author: By
Last change:
Date: 2 months ago
Size: 635 bytes
 

Contents

Class file image Download
<?php
   
include "../include/autoload.php";
   
header("Content-Type: application/json");

    if (isset(
$_POST["username"])) {
       
$username = $_POST["username"];
       
$lastname = $_POST["last"];
       
$firstname = $_POST["first"];
       
$id = $_POST["id"];

       
//Creating an instance of a class
       
$update_data = new UserController();
       
$edit_response[] = $update_data->updateUserData($id, $username, $firstname, $lastname);
        echo
json_encode($edit_response);
    }else{
       
$error[] = array("message" => "POST update is not set");
        echo
json_encode($error);
    }
?>