PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php $method = "POST"; switch($method){ case "POST": $user = json_decode(file_get_contents('php://input')); $sql = " SELECT null ,:name, :email, :mobile, :created_at"; $stm = $pdo->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; }
Show:  
Copy Clear