Commit 0b634848 by Eirene Hutasoit

menambahkan fungsi

parent 8c475bc5
<?php
global $conn;
$conn = mysql_connect("localhost", "root", "");
if(!$conn){
die("database connect problem");
}
$db_use = mysql_select_db("proyek", $conn) or die ("select db problem!!");
function execQ($strQ){
global $conn;
$res = mysql_query($strQ, $conn);
return $res;
}
function getUser($username, $password){
$strQ = "select * from user where username = '$username' AND password='$password'";
$resUsr = execQ($strQ);
if (mysql_num_rows($resUsr) > 0) {
return $resUsr;
}else{
return NULL;
}
}
function getAllKeluhan(){
$strQ = "SELECT * FROM keluhan";
$resItem = execQ($strQ);
if(mysql_num_rows($resItem)!=0){
$ret = array();
while($data = mysql_fetch_assoc($resItem)){
array_push($ret, array(
'id' => $data['ID'],
'nama_pengunjung' => $data['namapengunjung'],
'email_pengunjung' => $data['emailpengunjung'],
'isi_keluhan' => $data['isikeluhan']
));
}
return $ret;
} else{
return false;
}
}
function getProfil(){
$strQ = "SELECT * FROM profil";
$resItem = execQ($strQ);
if(mysql_num_rows($resItem)!=0){
$ret = array();
while($data = mysql_fetch_assoc($resItem)){
array_push($ret, array(
'id' => $data['id'],
'gambar' => $data['gambar'],
'konten' => $data['konten']
));
}
return $ret;
} else{
return false;
}
}
function getDaftar(){
$strQ = "SELECT * FROM kamar";
$resItem = execQ($strQ);
if(mysql_num_rows($resItem)!=0){
$ret = array();
while($data = mysql_fetch_assoc($resItem)){
array_push($ret, array(
'id' => $data['id'],
'nama' => $data['nama kamar'],
'kapasitas' => $data['kapasitas kamar'],
'harga' => $data['harga'],
'gambar' => $data['gambar']
));
}
return $ret;
} else{
return false;
}
}
function redirect($_location){
header('Location: ' .$_location);
}
\ No newline at end of file
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