วันอังคารที่ 8 ธันวาคม พ.ศ. 2563
วันอาทิตย์ที่ 8 พฤศจิกายน พ.ศ. 2563
eregi_replace
<span><?=eregi_replace($val,'<font style="color:#ff0000">'.$val.'</font>',$rno );?></span>
show hide row with class
$("#hideit").click(function() {
var table = $('#myTable').DataTable();
$.fn.dataTable.ext.search.push(
function(settings, data, dataIndex) {
return $(table.row(dataIndex).node()).hasClass("hidden");
}
);
table.draw();
});
$("#showit").click(function() {
var table = $("#myTable").DataTable();
$.fn.dataTable.ext.search.pop();
table.draw();
});
} );
วันศุกร์ที่ 30 ตุลาคม พ.ศ. 2563
php seach in array multidimention
Array
(
[0] => Array
(
[id] => 7
[name] => เงินเบิก 1
[detail] => เงินเบิก
)
[1] => Array
(
[id] => 8
[name] => เงินเบิก 2
[detail] => ค่าเครื่องแบบ
)
[2] => Array
(
[id] => 9
[name] => เงินเบิก 3
[detail] => ประกันอุบัติเหตุ
)
[3] => Array
(
[id] => 10
[name] => เงินเบิก 4
[detail] => ร้านค้า
)
[4] => Array
(
[id] => 11
[name] => เงินเบิก 5
[detail] => ค่าอบรม
)
) if( in_array($rd['id'], array_column($arrd, 'deduct_no'))){
echo " checked=true";
}
วันอังคารที่ 27 ตุลาคม พ.ศ. 2563
sweetalert2 show iframe disable "ok button" and "don't click outsize "
swal.fire({
title:'เพิ่มวันหยุดประจำปี',
width: 600,
showCloseButton: true, // show button X on top left
showCancelButton: false, /// show cancel
showConfirmButton: false, /// show ok button
allowOutsideClick: false, /// don't click outsize
onClose: Refreshs, /// event on close
html: '<iframe src="holiday.php?_method=POST&date='+date+'" width="100%" height="500" src="" ></iframe>',
}) ;
function Refreshs() {
window.location.reload();
}
วันเสาร์ที่ 17 ตุลาคม พ.ศ. 2563
create table on fly with ADD UNIQUE INDEX
mysql_query("DROP TABLE IF EXISTS $table ")
mysql_query("CREATE TABLE $table select * from stock where 1 = 2 ")
mysql_query("ALTER TABLE `$table` ADD UNIQUE INDEX ( `code_no`)")
วันพฤหัสบดีที่ 15 ตุลาคม พ.ศ. 2563
validate input jquery
<style>
.error {
border:solid red 1px;
}
</style>
<input type="text" class="validate">
<script>
$(".validate").each(function(i,v) {
if(v.value == "") {
$(this).addClass('error');
}else{
$(this).removeClass('error');
}
});
</script>
วันพุธที่ 25 มีนาคม พ.ศ. 2563
วันพฤหัสบดีที่ 13 กุมภาพันธ์ พ.ศ. 2563
Install PHP7.2 Ubuntu 16 E: Unable to locate package
sudo apt-get install php7.2
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php7.2
E: Couldn't find any package by glob 'php7.2'
E: Couldn't find any package by regex 'php7.2'
เพิ่มใน sudo nano /etc/apt/sources.listdeb http://us.archive.ubuntu.com/ubuntu/ bionic main restricted
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
deb http://us.archive.ubuntu.com/ubuntu/ bionic universe
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates universe
deb http://us.archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
deb http://us.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu bionic-security main restricted
deb http://security.ubuntu.com/ubuntu bionic-security universe
deb http://security.ubuntu.com/ubuntu bionic-security multiverse
deb [arch=amd64] http://mirror.nodesdirect.com/mariadb/repo/10.3/ubuntu bionic main
sudo /etc/init.d/apache2 restart