UPDATE table_name SET field = replace(field, 'string-to-find', 'string-that-will-replace-it');
Black Snippet
Code Snippet For PHP, JS, jQuery, Sql, etc
Sunday, December 16, 2018
Replace string in Field Value with SQL
Replace string value in MySQL
Labels:
sql
Cek Double Entri Field with SQL
Cek Double Entry
SELECT field_name, COUNT(*) c FROM table_name GROUP BY field_name HAVING c > 1
Labels:
sql
Friday, November 16, 2018
Memaksa Checkbox mempunyai nilai
Memaksa Checkbox mempunyai nilai, baik yang diselect maupun tidak. Yg diselect bernilai 1 dan yang tidak bernilai 0
$("#form1").submit(function () { var this_master = $(this); this_master.find('input[type="checkbox"]').each( function () { var checkbox_this = $(this); if( checkbox_this.is(":checked") == true ) { checkbox_this.attr('value','1'); } else { checkbox_this.prop('checked',true); //DONT' ITS JUST CHECK THE CHECKBOX TO SUBMIT FORM DATA checkbox_this.attr('value','0'); } }) })
Friday, May 8, 2015
Mengatur List Panjang dengan Tinggi Tertentu
<div STYLE=" height: 200px; width: 100%; overflow: auto;"> <table class="grid" width="100%"> <tr> <td width="50"><b>ID</b></td> <td width="200"><b>Nama Kontak</b></td> <td width="10"><b>Aksi</b></td> </tr> <? foreach($arr_kota as $key=>$val): ?> <tr> <td><?=$val->kota_id;?></td> <td><?=$val->kota_name;?></td> <td><input type='checkbox' name='kota[]' value='<?=$val->kota_id;?>' id="kota" class="kota"></td> </tr> <? endforeach; ?> </table> </div>
HTML Check UnCheck Form
Kode jQuery:
$(window).load(function(){ $("#checkAll").change(function () { $("input:checkbox").prop('checked', $(this).prop("checked")); }); });Kombinasikan dengan HTML berikut:
TGL INPUT | |
---|---|
2015-01-01 |
Subscribe to:
Posts (Atom)