mocart2

php ajax

Jun 13th, 2021
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.81 KB | None | 0 0
  1. <?php
  2.  
  3. try {
  4.  
  5.     $testdata = array('tdate' => '12.06.2021', 'ttime' => '23:16:20', 'consult' => 'cons1', 'price' => rand(1000, 4000), 'cname' => 'Test User', 'phone' => '899999999999', 'bdate' => '01.01.1999', 'btime' => '16:32:32', 'bplace' => 'Москва', 'email' => '[email protected]', 'question' => 'lorem');
  6.     $file_db = new PDO('sqlite:db.sqlite3');
  7.     $file_db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  8.  
  9.     $insert = "INSERT INTO tasks (tdate, ttime, consult, price, cname, phone, bdate, btime, bplace, email, question) VALUES (:tdate, :ttime, :consult, :price, :cname, :phone, :bdate, :btime, :bplace, :email, :question)";
  10.     $stmt = $file_db->prepare($insert);
  11.     $stmt->execute($testdata);
  12.     $send_stat['status'] = 1;
  13.     echo json_encode($send_stat);
  14. } catch (PDOException $e) {
  15.     echo $e->getMessage();
  16. }
Advertisement
Add Comment
Please, Sign In to add comment