本文整理汇总了PHP中updateQuery函数的典型用法代码示例。如果您正苦于以下问题:PHP updateQuery函数的具体用法?PHP updateQuery怎么用?PHP updateQuery使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了updateQuery函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doJournal
/**
* doJournal
* Lakukan Jurnal berdasarkan data yang diberikan
*/
public function doJournal($pt, $kodeJurnal, $dataRes, $counter, $ketKelompok = "", $updateCounter = true)
{
global $dbname;
#Cek Nojurnal sudah terdaftar, Jika sudah terdaftar exit
$sCek = "select nojurnal from " . $dbname . ".keu_jurnaldt where nojurnal='" . $dataRes['header']['nojurnal'] . "'";
$qCek = mysql_query($sCek) or die(mysql_error($conn));
$rCek = mysql_num_rows($qCek);
if ($rCek != 0) {
exit("warning: Nojurnal :" . $dataRes['header']['nojurnal'] . " sudah ada");
}
$qHeader = insertQuery($dbname, 'keu_jurnalht', $dataRes['header']);
$qDetail = insertQuery($dbname, 'keu_jurnaldt', $dataRes['detail']);
$dataIns = array($pt, $kodeJurnal, $ketKelompok, $counter);
$insCounter = insertQuery($dbname, 'keu_5kelompokjurnal', $dataIns);
$updCounter = updateQuery($dbname, 'keu_5kelompokjurnal', array('nokounter' => $counter), "kodeorg='" . $pt . "' and kodekelompok='" . $kodeJurnal . "'");
if (!mysql_query($qHeader)) {
echo "Header DB Error: " . mysql_error() . "\n";
$this->rbJournal($dataRes['header']['nojurnal']);
exit;
} else {
if (!mysql_query($qDetail)) {
echo "Detail DB Error: " . mysql_error() . "\n";
$this->rbJournal($dataRes['header']['nojurnal']);
exit;
} else {
if ($updateCounter) {
if (!mysql_query($insCounter)) {
// Insert Kelompok Jurnal jika belum ada
if (!mysql_query($updCounter)) {
// Update jika sudah ada
echo "DB Error: " . mysql_error() . "\n";
$this->rbJournal($dataRes['header']['nojurnal']);
exit;
}
}
}
}
}
}
示例2: unset
// {
// exit("[ Error ]: Akun ".$data['noakun']." harus dilengkapi dengan NIK/nama Karyawan.");
// }
//=====end tambahan dz
unset($data['nojurnal']);
unset($data['kodejurnal']);
unset($data['nourut']);
$data['tanggal'] = tanggalsystem($data['tanggal']);
$data['jumlah'] = str_replace(',', '', $data['jumlah']);
foreach ($data as $key => $cont) {
if (substr($key, 0, 5) == 'cond_') {
unset($data[$key]);
}
}
$where = "nojurnal='" . $param['nojurnal'] . "' and nourut='" . $param['nourut'] . "'";
$query = updateQuery($dbname, 'keu_jurnaldt', $data, $where);
if (!mysql_query($query)) {
echo "DB Error : " . mysql_error();
exit;
}
echo json_encode($param);
break;
case 'delete':
$where = "nojurnal='" . $param['nojurnal'] . "' and nourut='" . $param['nourut'] . "'";
$query = "delete from `" . $dbname . "`.`keu_jurnaldt` where " . $where;
if (!mysql_query($query)) {
echo "DB Error : " . mysql_error();
exit;
}
break;
default:
示例3: explode
$primVal = explode('##', $_POST['primVal']);
unset($primary['namabarang']);
unset($primary['satuan']);
unset($data['namabarang']);
unset($data['satuan']);
# Create Condition
$where = "";
for ($i = 1; $i < count($primary); $i++) {
if ($i == 1) {
$where .= "`" . $primary[$i] . "`='" . $primVal[$i] . "'";
} else {
$where .= " AND `" . $primary[$i] . "`='" . $primVal[$i] . "'";
}
}
# Create Query
$query = updateQuery($dbname, 'setup_kegiatannorma', $data, $where);
# Update Data
if (!mysql_query($query)) {
echo "DB Error : " . mysql_error($conn);
}
break;
case 'delete':
$data = $_POST;
unset($data['proses']);
unset($data['primary']);
unset($data['primVal']);
$primary = explode('##', $_POST['primary']);
$primVal = explode('##', $_POST['primVal']);
unset($primary['namabarang']);
unset($primary['satuan']);
unset($data['namabarang']);
示例4: foreach
$res = "";
foreach ($data as $cont) {
$res .= "##" . $cont;
}
$result = "{res:\"" . $res . "\",theme:\"" . $_SESSION['theme'] . "\"}";
echo $result;
break;
case 'edit':
$data = $param;
foreach ($data as $key => $cont) {
if (substr($key, 0, 5) == 'cond_') {
unset($data[$key]);
}
}
$where = "kodeorg='" . $param['kodeorg'] . "' and shift=" . $param['shift'] . " and nik='" . $param['cond_nik'] . "'";
$query = updateQuery($dbname, 'pabrik_5shiftanggota', $data, $where);
if (!mysql_query($query)) {
echo "DB Error : " . mysql_error();
exit;
}
echo json_encode($param);
break;
case 'delete':
$where = "kodeorg='" . $param['kodeorg'] . "' and shift=" . $param['shift'] . " and nik='" . $param['nik'] . "'";
$query = "delete from `" . $dbname . "`.`pabrik_5shiftanggota` where " . $where;
if (!mysql_query($query)) {
echo "DB Error : " . mysql_error();
exit;
}
break;
default:
示例5: str_replace
$data['rupiahpersatuan'] = str_replace(',', '', $data['rupiahpersatuan']);
foreach ($data as $key => $cont) {
if (substr($key, 0, 5) == 'cond_') {
unset($data[$key]);
}
}
cekRealisasi($param);
$where = "notransaksi='" . $param['notransaksi'] . "'and kodekegiatan='" . $param['cond_kodekegiatan'] . "' and kodeblok='" . $param['cond_kodeblok'] . "'";
$query = updateQuery($dbname, 'log_spkdt', $data, $where);
if (!mysql_query($query)) {
echo "DB Error : " . mysql_error();
exit;
} else {
$whereBA = "notransaksi='" . $param['notransaksi'] . "'and kodekegiatan='" . $param['cond_kodekegiatan'] . "' and blokspkdt='" . $param['cond_kodeblok'] . "'";
$dataBA = array('kodekegiatan' => $param['kodekegiatan'], 'blokspkdt' => $param['kodeblok']);
$queryBA = updateQuery($dbname, 'log_baspk', $dataBA, $whereBA);
if (!mysql_query($queryBA)) {
echo "DB Error : " . mysql_error();
exit;
}
}
echo json_encode($param);
break;
/** Delete existing data detail */
/** Delete existing data detail */
case 'delete':
//================periksa realisasi
$m = 0;
$strx = "select sum(jumlahrealisasi) from " . $dbname . ".log_baspk \n where notransaksi='" . $param['notransaksi'] . "'";
$resx = mysql_query($strx);
while ($barx = mysql_fetch_array($resx)) {
示例6: mysql_error
$errorDB .= "Rollback 2 Error :" . mysql_error() . "\n" . $queryRB2;
}
if (!mysql_query($queryRBKonter)) {
$errorDB .= "Rollback Counter Error :" . mysql_error() . "\n" . $queryRBKonter;
}
echo "DB Error :\n" . $errorDB;
exit;
}
}
}
// else if namabarang
if (empty($errorDB)) {
// Update Setup Blok, jika kegiatan sisip, completering, tanam baru
$where = "nilai = '" . $kodekegiatan . "' and kodeaplikasi = 'TN'";
// kalo kodeparameter SISIP
$query = selectQuery($dbname, 'setup_parameterappl', '*', $where);
$resSisip = fetchData($query);
if (!empty($resSisip)) {
// Ambil Blok Lama
$qBlok = selectQuery($dbname, 'setup_blok', 'jumlahpokok', "kodeorg='" . $kodeblok . "'");
$resBlok = fetchData($qBlok);
// Update Blok Baru
$dataUpd = array('jumlahpokok' => $resBlok[0]['jumlahpokok'] + $hasilkerja);
$updBlok = updateQuery($dbname, 'setup_blok', $dataUpd, "kodeorg='" . $kodeblok . "'");
if (!mysql_query($updBlok)) {
exit("Update Blok Error: " . mysql_error());
}
}
}
}
// else 256
示例7: getLatestContents
function getLatestContents($nbcontents, $sort_type = 0, $catselect = "no", $rootid = null)
{
switch ($sort_type) {
/* Popular */
case 2:
$order_sql = "ORDER BY a.views DESC,a.date_created DESC ,a.id DESC ";
break;
/* Random */
/* Random */
case 1:
$order_sql = "ORDER BY RAND() ";
break;
/* Latest */
/* Latest */
case 0:
default:
$order_sql = "ORDER BY a.date_created DESC ,a.id DESC ";
break;
}
if (version_compare(JVERSION, '1.6', 'ge')) {
$listCategories = TPermissions::getAuthorisedCategories('read');
//If the variable is an array and if it's not empty, we add a filter to the request
//If not we're not return any category
if (is_array($listCategories) && !empty($listCategories)) {
$categories = implode(',', $listCategories);
$listCategories = " AND c.id IN (" . $categories . ") ";
} else {
$listCategories = " AND 0 ";
}
} else {
$listCategories = "";
}
$cat_query = "";
switch ($catselect) {
case "no":
break;
case "-1":
$catid = JRequest::getInt('catid', 0);
if ($catid != 0 && $catid != -1) {
$this->_db->setQuery("SELECT c.id, c.name,c.parent " . " FROM #__adsmanager_categories as c " . " WHERE c.published = 1 {$listCategories} ORDER BY c.parent,c.ordering");
$listcats = $this->_db->loadObjectList();
//List
$list = array();
$list[] = $catid;
$this->_recurseSearch($listcats, $list, $catid);
$listids = implode(',', $list);
$cat_query = "adcat.catid IN ({$listids}) AND ";
}
break;
default:
$this->_db->setQuery("SELECT c.id, c.name,c.parent " . " FROM #__adsmanager_categories as c " . " WHERE c.published = 1 {$listCategories} ORDER BY c.parent,c.ordering");
$listcats = $this->_db->loadObjectList();
$catsid = explode(',', $catselect);
//List
$list = array();
foreach ($catsid as $catid) {
$list[] = $catid;
$this->_recurseSearch($listcats, $list, $catid);
}
$listids = implode(',', $list);
$cat_query = " adcat.catid IN ({$listids}) AND ";
break;
}
if (ADSMANAGER_SPECIAL == 'newspaper') {
$cat_query .= " (a.ad_publishtype = 'both' OR a.ad_publishtype = 'online') AND ";
}
$currentSession = JSession::getInstance('none', array());
$sql = $currentSession->get("sqlglobalfilter", "");
$globalfilter = "";
if ($sql != "") {
$globalfilter = " AND {$sql} ";
}
$sql = " SELECT a.*,p.id as parentid,p.name as parent,c.id as catid, c.name as cat,u.username as user " . " FROM #__adsmanager_ads as a " . " INNER JOIN #__adsmanager_adcat as adcat ON adcat.adid = a.id " . " LEFT JOIN #__users as u ON a.userid = u.id " . " INNER JOIN #__adsmanager_categories as c ON adcat.catid = c.id " . " LEFT JOIN #__adsmanager_categories as p ON c.parent = p.id " . " WHERE 1 {$globalfilter} AND {$cat_query} c.published = 1 and a.published = 1 GROUP BY a.id {$order_sql} LIMIT 0, {$nbcontents}";
if (function_exists("updateQuery")) {
updateQuery($sql);
}
$this->_db->setQuery($sql);
$contents = $this->_db->loadObjectList();
if ($contents == null) {
$contents = array();
}
foreach ($contents as &$content) {
$content->images = @json_decode($content->images);
$content->cat = JText::_($content->cat);
if ($content->parent != "") {
$content->parent = JText::_($content->parent);
}
if (!is_array($content->images)) {
$content->images = array();
}
}
return $contents;
}
示例8: mysql_error
if (!mysql_query($queryToJ)) {
$errorDB .= "Posting Mark Error :" . mysql_error() . "\n";
}
$queryKonter = updateQuery($dbname, 'keu_5kelompokjurnal', array('nokounter' => $tmpKonter[0]['nokounter'] + 1), "kodeorg='" . $_SESSION['org']['kodeorganisasi'] . "' and kodekelompok='" . $kodeJurnal . "'");
if (!mysql_query($queryKonter)) {
$errorDB .= "Update Counter Error :" . mysql_error() . "\n" . $errorDB . "___" . $queryKonter;
}
}
}
}
if ($errorDB != "") {
// Rollback
$where = "nojurnal='" . $nojurnal . "'";
$queryRB = "delete from `" . $dbname . "`.`keu_jurnalht` where " . $where;
$queryRB2 = updateQuery($dbname, 'kebun_aktifitas', array('jurnal' => 0), "notransaksi='" . $dataH[0]['notransaksi'] . "'");
$queryRBKonter = updateQuery($dbname, 'keu_5kelompokjurnal', array('nokounter' => $tmpKonter[0]['nokounter']), "kodeorg='" . $_SESSION['org']['kodeorganisasi'] . "' and kodekelompok='" . $kodeJurnal . "'");
if (!mysql_query($queryRB)) {
$errorDB .= "Rollback 1 Error :" . mysql_error() . "\n";
}
if (!mysql_query($queryRB2)) {
$errorDB .= "Rollback 2 Error :" . mysql_error() . "\n";
}
if (!mysql_query($queryRBKonter)) {
$errorDB .= "Rollback Counter Error :" . mysql_error() . "\n";
}
echo "DB Error :\n" . $errorDB . "___" . $queryRB2;
//echo "DB Error :\n".$errorDB."___".$queryRB2;
exit;
} else {
// Posting Success
}
示例9: foreach
if ($headErr == '') {
$detailErr = '';
foreach ($dataRes['detail'] as $row) {
$insDet = insertQuery($dbname, 'keu_jurnaldt', $row);
if (!mysql_query($insDet)) {
$detailErr .= "Insert Detail Error : " . addslashes(mysql_error($conn)) . "\n";
break;
}
}
if ($detailErr == '') {
# Header and Detail inserted
#>>> Update Kode Jurnal
// $updJurnal = updateQuery($dbname,'keu_5kelompokjurnal',array('nokounter'=>$konter),
// "kodeorg='".$_SESSION['org']['kodeorganisasi'].
// "' and kodekelompok='".$kodeJurnal."'");
$updJurnal = updateQuery($dbname, 'keu_5kelompokjurnal', array('nokounter' => $konter), "kodeorg='" . $ptpengguna . "' and kodekelompok='" . $kodeJurnal . "'");
if (!mysql_query($updJurnal)) {
echo "Update Kode Jurnal Error : " . addslashes(mysql_error($conn)) . "\n";
# Rollback if Update Failed
$RBDet = deleteQuery($dbname, 'keu_jurnalht', "nojurnal='" . $nojurnal . "'");
if (!mysql_query($RBDet)) {
echo "Rollback Delete Header Error : " . addslashes(mysql_error($conn)) . "\n";
exit;
}
exit;
} else {
#berhasil di jurnal
// echo "warning: \nheader1pemilik_".$header1pemilik."\nnojurnal_".$nojurnal."\n".$insHead;
// exit;
#proses gudang
$errGudang = '';
示例10: prosesGajiKebun
function prosesGajiKebun()
{
global $conn;
global $tanggal;
global $param;
global $dbname;
global $defSegment;
#karyawan kebun
#output pada jurnal kolom noreferensi ALK_GAJI
if ($param['komponen'] == 1 or $param['komponen'] == 14) {
$group = 'KBNB0';
} elseif ($param['komponen'] == 16 or $param['komponen'] == 32 or $param['komponen'] == 33) {
$group = 'KBNB1';
} elseif ($param['komponen'] == 28) {
$group = 'KBNB3';
} elseif ($param['komponen'] == 26) {
$group = 'KBNB4';
} elseif ($param['komponen'] == 21) {
$group = 'KBNB5';
} else {
$group = 'KBNB2';
}
//defaultnya tunjangan
$str = "select noakundebet,noakunkredit from " . $dbname . ".keu_5parameterjurnal\r\n where jurnalid='" . $group . "' limit 1";
$res = mysql_query($str);
if (mysql_num_rows($res) < 1) {
exit("Error: No.Akun pada parameterjurnal belum ada untuk " . $param['namakomponen']);
} else {
$akundebet = '';
$akunkredit = '';
$bar = mysql_fetch_object($res);
$akundebet = $bar->noakundebet;
$akunkredit = $bar->noakunkredit;
}
#proses data
$kodeJurnal = $group;
#======================== Nomor Jurnal =============================
# Get Journal Counter
$queryJ = selectQuery($dbname, 'keu_5kelompokjurnal', 'nokounter', "kodeorg='" . $_SESSION['org']['kodeorganisasi'] . "' and kodekelompok='" . $kodeJurnal . "' ");
$tmpKonter = fetchData($queryJ);
$konter = addZero($tmpKonter[0]['nokounter'] + 1, 3);
# Transform No Jurnal dari No Transaksi
$nojurnal = str_replace("-", "", $tanggal) . "/" . $_SESSION['empl']['lokasitugas'] . "/" . $kodeJurnal . "/" . $konter;
#======================== /Nomor Jurnal ============================
# Prep Header
$dataRes['header'] = array('nojurnal' => $nojurnal, 'kodejurnal' => $kodeJurnal, 'tanggal' => $tanggal, 'tanggalentry' => date('Ymd'), 'posting' => 1, 'totaldebet' => $param['jumlah'], 'totalkredit' => -1 * $param['jumlah'], 'amountkoreksi' => '0', 'noreferensi' => 'ALK_GAJI', 'autojurnal' => '1', 'matauang' => 'IDR', 'kurs' => '1', 'revisi' => '0');
# Data Detail
$noUrut = 1;
# Debet
$dataRes['detail'][] = array('nojurnal' => $nojurnal, 'tanggal' => $tanggal, 'nourut' => $noUrut, 'noakun' => $akundebet, 'keterangan' => $param['namakomponen'] . ' ' . $param['namakaryawan'], 'jumlah' => $param['jumlah'], 'matauang' => 'IDR', 'kurs' => '1', 'kodeorg' => $_SESSION['empl']['lokasitugas'], 'kodekegiatan' => '', 'kodeasset' => '', 'kodebarang' => '', 'nik' => $param['karyawanid'], 'kodecustomer' => '', 'kodesupplier' => '', 'noreferensi' => 'ALK_GAJI', 'noaruskas' => '', 'kodevhc' => '', 'nodok' => '', 'kodeblok' => $param['subbagian'], 'revisi' => '0', 'kodesegment' => $defSegment);
$noUrut++;
# Kredit
$dataRes['detail'][] = array('nojurnal' => $nojurnal, 'tanggal' => $tanggal, 'nourut' => $noUrut, 'noakun' => $akunkredit, 'keterangan' => $param['namakomponen'] . ' ' . $param['namakaryawan'], 'jumlah' => -1 * $param['jumlah'], 'matauang' => 'IDR', 'kurs' => '1', 'kodeorg' => $_SESSION['empl']['lokasitugas'], 'kodekegiatan' => '', 'kodeasset' => '', 'kodebarang' => '', 'nik' => $param['karyawanid'], 'kodecustomer' => '', 'kodesupplier' => '', 'noreferensi' => 'ALK_GAJI', 'noaruskas' => '', 'kodevhc' => '', 'nodok' => '', 'kodeblok' => $param['subbagian'], 'revisi' => '0', 'kodesegment' => $defSegment);
$noUrut++;
/*
#periksa apakah sudah pernah diproses dengan karyawan yang sama
$str="select * from ".$dbname.".keu_jurnaldt where nojurnal
like '".str_replace("-","",$tanggal)."/".$_SESSION['empl']['lokasitugas']."/".$kodeJurnal."/%'
and noakun='".$akundebet."' and nik='".$param['karyawanid']."'";
if(mysql_num_rows(mysql_query($str))>0)
exit("Error: Data sudah pernah di proses");
*
*/
$insHead = insertQuery($dbname, 'keu_jurnalht', $dataRes['header']);
if (!mysql_query($insHead)) {
$headErr .= 'Insert Header BTL Error : ' . mysql_error() . "\n";
}
if (empty($headErr)) {
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Insert Detail
$detailErr = '';
foreach ($dataRes['detail'] as $row) {
$insDet = insertQuery($dbname, 'keu_jurnaldt', $row);
echo $insDet;
if (!mysql_query($insDet)) {
$detailErr .= "Insert Detail Error 2 : " . mysql_error() . "\n";
break;
}
}
if ($detailErr == '') {
# Header and Detail inserted
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Update Kode Jurnal
$updJurnal = updateQuery($dbname, 'keu_5kelompokjurnal', array('nokounter' => $konter), "kodeorg='" . $_SESSION['org']['kodeorganisasi'] . "' and kodekelompok='" . $kodeJurnal . "'");
if (!mysql_query($updJurnal)) {
echo "Update Kode Jurnal Error : " . mysql_error() . "\n";
# Rollback if Update Failed
$RBDet = deleteQuery($dbname, 'keu_jurnalht', "nojurnal='" . $nojurnal . "'");
if (!mysql_query($RBDet)) {
echo "Rollback Delete Header BTL Error : " . mysql_error() . "\n";
exit;
}
exit;
} else {
}
} else {
echo $detailErr;
# Rollback, Delete Header
$RBDet = deleteQuery($dbname, 'keu_jurnalht', "nojurnal='" . $nojurnal . "'");
if (!mysql_query($RBDet)) {
echo "Rollback Delete Header Error : " . mysql_error();
exit;
//.........这里部分代码省略.........
示例11: unset
case 'edit':
$data = $_POST;
unset($data['nojurnal']);
$data['tanggal'] = tanggalsystem($data['tanggal']);
//echo "warning: <pre>";
//print_r($data);
//echo "<pre>";
$query = updateQuery($dbname, 'keu_jurnalht', $data, "nojurnal='" . $_POST['nojurnal'] . "'");
if (!mysql_query($query)) {
echo "DB Error : " . mysql_error();
} else {
$data['tanggal'] = tanggalnormal($data['tanggal']);
echo json_encode($data);
}
$dataz['revisi'] = $_POST['revisi'];
$query = updateQuery($dbname, 'keu_jurnaldt', $dataz, "nojurnal='" . $_POST['nojurnal'] . "'");
if (!mysql_query($query)) {
echo "DB Error : " . mysql_error();
}
// else {
// $dataz['revisi'] = $_POST['revisi'];
// echo json_encode($dataz);
// }
break;
case 'delete':
$query = selectQuery($dbname, 'keu_jurnaldt', 'nojurnal', "nojurnal='" . $data['nojurnal'] . "'");
$res = fetchData($query);
if (empty($res)) {
$qDel = "delete from `" . $dbname . "`.`keu_jurnalht` where nojurnal='" . $data['nojurnal'] . "'";
echo $qDel;
if (!mysql_query($qDel)) {
示例12: checkPostGet
require_once 'master_validation.php';
require_once 'config/connection.php';
require_once 'lib/nangkoelib.php';
require_once 'lib/zLib.php';
require_once 'lib/fpdf.php';
require_once 'lib/terbilang.php';
$proses = $_GET['proses'];
$kodevhc = checkPostGet('kodevhc', '');
$kmhmakhir = checkPostGet('kmhmakhir', '');
switch ($proses) {
case 'getKm':
$qKm = selectQuery($dbname, 'vhc_kmhm_track', 'kmhmakhir', "kodevhc='" . $kodevhc . "'");
$resKm = fetchData($qKm);
if (empty($resKm)) {
echo 0;
} else {
echo $resKm[0]['kmhmakhir'];
}
break;
case 'reset':
$dataIns = array($kodevhc, $kmhmakhir);
$qIns = insertQuery($dbname, 'vhc_kmhm_track', $dataIns);
if (!mysql_query($qIns)) {
$dataUpd = array('kmhmakhir' => $kmhmakhir);
$qUpd = updateQuery($dbname, 'vhc_kmhm_track', $dataUpd, "kodevhc='" . $kodevhc . "'");
if (!mysql_query($qUpd)) {
exit("Update KM/HM Error: " . mysql_error());
}
}
break;
}
示例13: mysql_query
$ada = false;
$yCek = mysql_query($xCek) or die(mysql_error());
while ($zCek = mysql_fetch_assoc($yCek)) {
$ada = true;
}
if ($ada == true) {
echo "warning : data already exist ";
exit;
}
// Input Budget BJR
$optThnTnm = makeOption($dbname, 'setup_blok', 'kodeorg,tahuntanam', "kodeorg='" . $kdblok . "'");
$dataIns = array('tahunbudget' => $thnbudget, 'kodeorg' => $kdblok, 'thntanam' => $optThnTnm[$kdblok], 'bjr' => $bjr, 'updateby' => $_SESSION['standard']['userid'], 'lastupdate' => date('Y-m-d H:i:s'), 'close' => 0);
$dataUpd = array('bjr' => $bjr, 'updateby' => $_SESSION['standard']['userid'], 'lastupdate' => date('Y-m-d H:i:s'));
$whereUpd = "tahunbudget='" . $thnbudget . "' and kodeorg='" . $kdblok . "' and thntanam='" . $optThnTnm[$kdblok] . "'";
$insBjr = insertQuery($dbname, 'bgt_bjr', $dataIns);
$updBjr = updateQuery($dbname, 'bgt_bjr', $dataUpd, $whereUpd);
if (!mysql_query($insBjr)) {
if (!mysql_query($updBjr)) {
exit("DB Error: " . mysql_error());
}
}
##UNTUK VALIDASI TAHUN DI BJR
// $iCek="select tahunbudget from ".$dbname.".bgt_bjr where tahunbudget='".$thnbudget."' ";
// exit("Error:$xCek");
// $ada=false;
// $nCek=mysql_query($iCek)or die(mysql_error());
// while($dCek=mysql_fetch_assoc($nCek))
// {
// $ada=true;
// }
// if ($ada==false)
示例14: mysql_error
if (!mysql_query($query)) {
echo "DB Error : " . mysql_error();
}
break;
case 'delete':
$where = "nokonosemen='" . $param['nokonosemen'] . "'";
$query = "delete from `" . $dbname . "`.`log_konosemenht` where " . $where;
if (!mysql_query($query)) {
echo "DB Error : " . mysql_error();
exit;
}
break;
case 'posting':
$data = array('postingkirim' => 1);
$where = "nokonosemen='" . $param['nokonosemen'] . "'";
$query = updateQuery($dbname, 'log_konosemenht', $data, $where);
if (!mysql_query($query)) {
echo "DB Error : " . mysql_error();
}
default:
break;
}
function formHeader($mode, $data)
{
global $dbname;
# Default Value
if (empty($data)) {
$data['nokonosemen'] = 'KS' . date('Ymdhi');
$data['nokonosemenexp'] = '';
$data['kodept'] = '';
$data['kodeorg'] = $_SESSION['empl']['lokasitugas'];
示例15: foreach
# Header
foreach ($data['header'] as $key => $dataDet) {
$queryH = insertQuery($dbname, 'keu_jurnalht', $dataDet);
if (!mysql_query($queryH)) {
$errorDB .= "Header :" . mysql_error() . "\n";
}
}
# Detail
if ($errorDB == '') {
foreach ($dataRes['detail'] as $key => $dataDet) {
$queryD = insertQuery($dbname, 'keu_jurnaldt', $dataDet);
if (!mysql_query($queryD)) {
$errorDB .= "Detail " . $key . " :" . mysql_error() . "\n";
}
}
#update jurnal counter
$queryKonter = updateQuery($dbname, 'keu_5kelompokjurnal', array('nokounter' => $konter + 1), "kodeorg='" . $param['pt'] . "' and kodekelompok='" . $kodejurnal . "'");
if (!mysql_query($queryKonter)) {
$errorDB .= "Update Counter Error :" . mysql_error() . "\n" . $errorDB . "___" . $queryKonter;
}
}
if ($errorDB != "") {
# Rollback
foreach ($arrNoJurnal as $key => $nojur) {
$queryRB = "delete from `" . $dbname . "`.`keu_jurnalht` where nojurnal='" . $nojur . "'";
if (!mysql_query($queryRB)) {
$errorDB .= "Rollback 1 Error :" . mysql_error() . "\n";
}
}
echo "Error " . $errorDB;
}