분류 전체보기
-
order by case 또는 select caseMYSQL 2020. 6. 11. 17:18
//현재 대기중 상태가 최상위에 나오도록 임의 필드값설정 후 정렬 $rec->select("(CASE WHEN r.status = '".Request::STATUS_WAIT."' THEN 1 ELSE 2 END) AS case_order"); $rec->order(array("case_order" => "ASC"); 또는 ORDER BY (CASE WHEN r.status = '".Request::STATUS_WAIT."' THEN 1 ELSE 2 END) ASC;
-
스크롤시작 종료JAVASCRIPT 2020. 6. 11. 17:17
$("#page-content-scroll").scroll(function() { //스크롤시작 clearTimeout($.data(this, 'scrollTimer')); $.data(this, 'scrollTimer', setTimeout(function() { $("#marketRegister").css("display", "block"); $("#scrollTopBtn").css("display", "block"); }, 200)); //스크롤종료시 2초후 실행 });
-
PHP 매직함수 사용법PHP 2020. 6. 11. 17:16
class a{ public function __set($key, $value) { if(is_string($value)) { $value = trim($value)."1111"; } $this->__fields[$key] = $value; } public function __get($key) { if(array_key_exists($key, $this->__fields)) { return $this->__fields[$key]."2222"; } return null; } } $a = new a(); $a->a = "10"; // 저장시 __set 호출 저장값 : 101111 $c = $a->a; // 호출시 __get 호출됨 호출값 : 1011112222 => 저장된 값에 호출값에 추가로 더한 값이 나온다
-
자바스크립트 많이 쓰일 함수들JAVASCRIPT 2020. 6. 11. 17:13
parseInt($("#making").val(), 10); //10진수 숫자로 변환 $(':radio[name="butterfly"]:checked').val(); //라디오버튼 체크된 값 $("select[name='viewSuboption[]']").each(function(){}); //해당셀렉터인풋배열 반복 $(this).find("option").each(function(){}); //해당셀렉터 옵션들 반복 Math.round((optWidth + 40) /130) + 1; // 반올림 Math.ceil((optWidth *2) /150) ; //올림 Math.floor((optWidth *2) /150) ; //내림 $("selector").each(function(){}); // 셀렉터만큼..
-
인풋 가격 콤마찍기JAVASCRIPT 2020. 6. 11. 17:12
$(".numberFormat").each(function(){ $(this).keyup(function(){ var val = $(this).val(); var res = numberWithCommas(numberWithUncommas(val)); $(this).val(res); }); }); function numberWithCommas(x) { return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); } function numberWithUncommas(x) { return x.toString().replace(/[^\d]+/g, ''); }