PHP store procedure with mysqli


/ Published in: PHP
Save to your folder(s)

Class of store procedure in PHP with mysqli


Copy this code and paste it in your HTML
  1. <?php
  2.  
  3. class dbconexion
  4. {
  5.  
  6. var $db="xxxx";
  7. var $user="xxxx";
  8. var $password="";
  9. var $host="localhost";
  10. var $conneccion;
  11. function conectarse()
  12. {
  13. $this->conneccion= mysqli_connect($this->host,$this->user,$this->password,$this->db);
  14. return $this->conneccion;
  15.  
  16. }
  17.  
  18. function procedimiento($sql)
  19. {
  20. $_displayResult = mysqli_query($this->conectarse(),$sql);
  21. return $_displayResult;
  22. }
  23.  
  24. }
  25.  
  26. /*
  27. $objeto = new dbconexion();
  28. $rs = $objeto->procedimiento("call sp_vista_ciudad();");
  29. while($fila = $rs->fetch_assoc())
  30. {
  31.   print_r($fila);
  32.  
  33. }*/
  34.  
  35.  
  36.  
  37. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.