Upload New File

parent 3c2e15bd
<?php
// include_once("../config.php")
$host = "localhost";
$user = "root";
$pass = "";
$db = "transportasidb";
$koneksi = mysqli_connect($host,$user,$pass,$db);
function query($query)
{
global $koneksi;
$result = mysqli_query($koneksi,$query);
$rows = []; ///siapkan kotak untuk naruh baju analogi
while ($row = mysqli_fetch_assoc($result))
{
$rows[] = $row;
}
return $rows;
}
if(!$koneksi){
die("Koneksi gagal: ".mysqli_connect_eror());
}
function register($data){
global $koneksi;
// get data
$nama = htmlspecialchars ($data["nama"]);
$email = htmlspecialchars ($data["email"]);
$alamat = htmlspecialchars ($data["alamat"]);
$j_kelamin = htmlspecialchars ($data["j_kelamin"]);
$username = htmlspecialchars ($data["username"]);
$password = htmlspecialchars ($data["password"]);
$role = "user";
// query
$query="INSERT INTO log_akun VALUES ('','$nama','$email','$alamat','$j_kelamin','$username','$password','$role')";
mysqli_query($koneksi,$query);
return mysqli_affected_rows($koneksi);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment