Dattz

Untitled

Jan 29th, 2018
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.38 KB | None | 0 0
  1. <?php
  2. class Apprentice{
  3.  
  4.     public $servername = 'localhost';
  5.     public $username = 'root';
  6.     public $password = 'root';
  7.     public $dbname = 'test';
  8.  
  9.     public $fullname;
  10.     public $email;
  11.     public $mobile;
  12.     public $apprenticeship;
  13.     public $experience;
  14.     public  $school_level;
  15.     public $certification;
  16.     public  $cv_path;
  17.     public  $driving_license;
  18.  
  19.     function __construct(){
  20.  
  21.         $conn = new mysqli($this->servername, $this->username, $this->password, $this->dbname);
  22.  
  23.         if ($conn->connect_error) {
  24.             die("Connection failed: " . $conn->connect_error);
  25.         }
  26.  
  27.     }
  28.  
  29.     function insertData($fullname,$email,$mobile,$apprenticeship, $experience, $school_level,$certification, $cv_path, $driving_license){
  30.  
  31.         $this->$fullname;
  32.         $this->$email;
  33.         $this->$mobile;
  34.         $this->$apprenticeship;
  35.         $this->$experience;
  36.         $this->$school_level;
  37.         $this->$certification;
  38.         $this->$cv_path;
  39.         $this->$drivinglicense;
  40.  
  41.  
  42.         $stmt = $conn->prepare ("INSERT INTO Apprentice (fullname, email, mobile,apprenticeship, experience, school_level, certification, resume, drivinglicense VALUES (?,?,?,?,?,?,?,?,?)");
  43.         $stmt->bind_param($fullname, $email, $mobile,$apprenticeship, $experience, $school_level,$certification, $cv_path, $driving_license);
  44.         $stmt->execute();
  45.  
  46.     }
  47. }
  48.  
  49. $Apprentice = new Apprentice();
  50. $Apprentice::insertData('pulkit','p@gmail.com','9815381537','test','test','test','test','test',55);
  51.  
  52. ?>
Add Comment
Please, Sign In to add comment