Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
<?php
$method = "POST";
switch($method){
case "POST";
$user = json_decode(file_get_contents('php://input'));
$sql = " SELECT null ,:name, :email, :mobile, :created_at";
$stm = $conn->prepare($sql);
$created_at = date('Y-M-D');
$stm->bindParam(':name', $user->name);
$stm->bindParam(':email', $user->email);
$stm->bindParam(':mobile', $user->mobile);
$stm->bindParam(':created_at', $created_at);
if($stm->execute()){ //error shows itself right here if it helps
$response = ['status'=> 1 , 'message'=>'successful'];
}else{
$response = ['status'=> 0 , 'message'=>'was NOT successful'];
}
echo json_encode($response);
break;
}