Advertisement
darryljf

record.class.php

May 4th, 2020
392
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.49 KB | None | 0 0
  1. <?php
  2.  
  3. class Record {
  4.  
  5.     protected $Conn;
  6.  
  7.     public function __construct($Conn) {
  8.         $this->Conn = $Conn;
  9.     }
  10.  
  11.     public function addToCrate($data){
  12.  
  13.         $query = "INSERT INTO records (user_id, title) VALUES (:user_id, :title)";
  14.  
  15.         $stmt = $this->Conn->prepare($query);
  16.         $title = $data['title'];
  17.         $stmt->execute(array(
  18.             'user_id'=>$_SESSION['user_data']['user_id'],
  19.             'title'=>$title
  20.         ));
  21.         return true;
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement