<?php

    $request_json=$_REQUEST["data"];
    $arr = json_decode($request_json, true);
    $name = $arr["name"];
    $contact = $arr["contact"];
    $date = date("Y-m-d");
    
    //include 'common/connection.php';
    $servername = "localhost";
    $username = "finstech_sales";
    $password = "SalesApp@123";
    $dbname = "finstech_salesapp";
    
    try {
      $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
      $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
      $sql = "insert into b2c_ustomer (name,contact,last_visited) 
                values('$name','$contact','$date')";
      $conn->exec($sql);
      echo "Success";
    } catch(PDOException $e) {
      echo $sql . "<br>" . $e->getMessage();
    }
    $conn = null;
    
?>