Postingan

Menampilkan postingan dari Oktober, 2022

untuk menyambungkan ke ubuntu

  <?php error_reporting ( 1 ); include "Database.php" ; $uri = 'http://192.168.56.7' ; $options = array ( 'uri' => $uri ); $server = new SoapServer ( NULL , $options ); $server -> setClass ( 'Database' ); $server -> handle (); ? >

Untuk membuat data dengan ubuntu

<?php error_reporting ( 1 ); // error ditampilkan class Database {   private $host = "" ;       private $dbname = "" ;     private $user = "root" ;     private $password = "" ;     private $port = "3306" ;     private $conn ;         // function yang pertama kali di-load saat class dipanggil     public function __construct ()     {   // koneksi database         try         {   $this -> conn = new PDO ( "mysql:host= $this -> host ;port= $this -> port ;dbname= $this -> dbname ;charset=utf8" , $this -> user , $this -> password );             } catch ( PDOException $e )         {   echo "Koneksi gagal" ;                   }     }       public function tampil_data ( $id_barang ){                     $query = $this -> conn -> prepare ( " SELECT * FROM   WHERE = ? " );         $query -> execute ( array ( $id_barang ));         // mengambil satu data dengan fetch