Create New Item
×
Item Type
File
Folder
Item Name
×
Search file in folder and subfolders...
File Manager
/
fsib
/
accountOpening-v2
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php header('Content-Type: application/json'); // Database configuration $host = 'localhost'; // Your database host $dbname = 'fsibplc_account_opening'; // Your database name $username = 'root'; // Your database username $password = ''; // Your database password try { // Create a new PDO instance $pdo = new PDO("mysql:host=$host;dbname=$dbname", $username, $password); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // Get the JSON input $input = json_decode(file_get_contents('php://input'), true); $accountNumber = $input['accountNumber']; $informed = $input['informed']; $id = $input['index']; // This index can be used to identify the specific applicant if($accountNumber != "NULL"){ $status = "Approved"; } else{ $status = "NULL"; } // Update the applicant's account_number and informed status $update_stmt = $pdo->prepare("UPDATE account_info SET ac_number = :accountNumber, account_info.status = :statusUpdate, inform = :informed WHERE id = :id"); $update_stmt->execute([ ':accountNumber' => $accountNumber, ':informed' => $informed, ':statusUpdate' => $status, ':id' => $id // Assuming ID is sequential starting from 1 ]); echo json_encode(['success' => true]); } catch (PDOException $e) { echo json_encode(['success' => false, 'error' => $e->getMessage()]); } ?>