Advertisement
Guest User

Untitled

a guest
Oct 20th, 2016
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. <?php
  2. class connDb{
  3. private $link;
  4. private $host;
  5. private $user;
  6. private $pass;
  7. private $dbname;
  8. public function __construct($host, $user, $pass, $dbname){
  9. $this->host=$host;
  10. $this->user=$user;
  11. $this->pass=$pass;
  12. $this->dbname=$dbname;
  13. $this->link=mysqli_connect($this->host, $this->user, $this->pass, $this->dbname)
  14. OR
  15. die("Not connected to MySQL");
  16. }
  17. }
  18. ?>
  19. <?php
  20. $conn1=new connDb("localhost", "root", "", "dbind");
  21. $xyz=$conn1->prepare("INSERT INTO table1 VALUES(?, ?, ?)");
  22. $x="vikas";
  23. $y="vikas@gmail.com";
  24. $z="123n";
  25. $xyz->bind_param('sss', $x, $y, $z);
  26.  
  27. $xyz->execute();
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement