Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*db_config.php*/
- <?php
- define("DB_HOST", "localhost");
- define("DB_USER", "root");
- define("DB_PASSWORD", "");
- define("DB_DATABASE", "mahasiswa");
- ?>
- /*creat_nama.php*/
- <?php
- $respon = array();
- if (isset($_GET['nama_mhs'])) {
- $nama_mhs = $_GET['nama_mhs'];
- mysql_connect("localhost","root","") or die("gagal melakukan koneksi");
- mysql_select_db("mahasiswa") or die("Gagal memilih database");
- $sql = "INSERT INTO tbl_input(nama_mhs) VALUES ($nama_mhs)";
- $query = mysql_query($sql);
- mysql_close();
- }
- ?>
- /*db_connect.php*/
- <?php
- class DB_CONNECT {
- function __construct() {
- $this->connect();
- }
- function __destruct(){
- $this->close();
- }
- function connect() {
- include '../Android_client/db_config.php';
- $con = mysql_connect (DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE ) or die (mysql_error());
- $db = mysql_select_db(DB_DATABASE) or die (mysql_error());
- return $con;
- }
- function close() {
- mysql_close();
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment