first commit
This commit is contained in:
No files matched your search
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
class tk_neraca {
|
||||
var $db_host;
|
||||
var $db_user;
|
||||
var $db_pass;
|
||||
var $allFields = array();
|
||||
var $strDBError = "";
|
||||
var $intRow = 0;
|
||||
|
||||
public function getAllFieldsById($id,$tahun){
|
||||
$sql="select a.*,b.name from mk_neraca b left join tk_neraca a on a.id=b.id and a.tahun='$tahun' where b.id='$id' order by a.id";
|
||||
$res = $db->query($sql);
|
||||
$allFields=array();
|
||||
$allFields = $res->fetchAll()[0];
|
||||
return $allFields;
|
||||
}
|
||||
|
||||
public function updateTKAkun($id,$tahun,$nilai){
|
||||
$strSQL1 = "select * from tk_neraca where Id='$id' and tahun='$tahun'";
|
||||
$resQuery1 = $db->query($strSQL1);
|
||||
if ($resQuery1 && ($resQuery1->numRows() != 0) && (mysqli_error($connect) == "")) {
|
||||
$strSQL2 ="update tk_neraca set nilai='$nilai' where Id='$id' and tahun='$tahun'";
|
||||
$resQuery2 = $db->query($strSQL2);
|
||||
}
|
||||
else {
|
||||
$strSQL2 ="insert into tk_neraca(id,tahun,nilai) values('$id','$tahun','$nilai')";
|
||||
$resQuery2 = $db->query($strSQL2);
|
||||
}
|
||||
|
||||
if ($resQuery2 ) {
|
||||
$this->intRow = mysql_affected_rows();
|
||||
return true;
|
||||
} else {
|
||||
$this->strDBError = mysqli_error($connect);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function db_connect(){
|
||||
$conn = mysql_connect($this->db_host, $this->db_user, $this->db_pass);
|
||||
if($conn) {
|
||||
mysql_select_db($this->db_database, $conn);
|
||||
}
|
||||
return $conn;
|
||||
}
|
||||
|
||||
public function db_disconnect(){
|
||||
mysqli_close();
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user