วันอังคารที่ 13 เมษายน พ.ศ. 2564

laravel 8 route 404 not found

/etc/apache2/site-avaliable/000-xxxxx
<Directory "path/to/laravel/project/public">
    Allowoverride All
</Directory>
sudo a2enmod rewrite

 systemctl restart apache2

วันอาทิตย์ที่ 7 มีนาคม พ.ศ. 2564

table fixed thead on top with css

 table {

  text-align: left;
  position: relative;
  border-collapse: collapse; 
}
th {
  background: white;
  position: sticky;
  top: 0; /* Don't forget this, required for the stickiness */
  box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.4);
}

วันเสาร์ที่ 30 มกราคม พ.ศ. 2564

ubuntu 16 install mysql5.6


sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu trusty universe'
sudo apt-get update
sudo apt install mysql-server-5.6 mysql-client-5.6



ที่มา

https://itectec.com/ubuntu/ubuntu-install-mysql-5-6-on-ubuntu-16-04/ 

วันอังคารที่ 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();

});

} );

datatable order

     $('#myTable').DataTable( {

        "order": [[ 2, "asc" ]]

    } );

วันศุกร์ที่ 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>