숫자 자릿수 표현하는 방법 알려주세요.ㅠㅠ...3자리 마사 콤마 삽입되게 하는 방법 알려주세요
본문
<form name="fboardlist" id="fboardlist" action="./board_list_update.php" onsubmit="return fboardlist_submit(this);" method="post">
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl ?>">
<input type="hidden" name="stx" value="<?php echo $stx ?>">
<input type="hidden" name="spt" value="<?php echo $spt ?>">
<input type="hidden" name="sca" value="<?php echo $sca ?>">
<input type="hidden" name="page" value="<?php echo $page ?>">
<input type="hidden" name="sw" value="">
<input type="hidden" name="jogun" value="<?php echo $_GET[jogun]?>">
<input type="hidden" name="fr_date" value="<?php echo $_GET[fr_date]?>">
<input type="hidden" name="to_date" value="<?php echo $_GET[to_date]?>">
<div class="tbl_head01 tbl_wrap">
<table>
<caption><?php echo $board['bo_subject'] ?> 목록</caption>
<thead>
<tr>
<?php if ($is_checkbox) { ?>
<th scope="col" style="padding:0 7px;">
<label for="chkall" class="sound_only">현재 페이지 게시물 전체</label>
<input type="checkbox" id="chkall" onclick="if (this.checked) all_checked(true); else all_checked(false);">
</th>
<?php } ?>
<th scope="col" style="padding:0 5px;"><center>No</center></th>
<th scope="col"><?php echo subject_sort_link('wr_datetime', $qstr2, 1) ?><center>Date</center></th>
<th scope="col" style="padding:0 10px;"><?php echo subject_sort_link('wr_subject', $qstr2, 1) ?><center>임대</center></th>
<th scope="col" style="padding:0 10px;"><?php echo subject_sort_link('wr_1', $qstr2, 1) ?><center>매매</center></th>
<th scope="col" style="padding:0 10px;"><?php echo subject_sort_link('wr_2', $qstr2, 1) ?><center>위치</center></th>
<th scope="col" style="padding:0 60px;"><?php echo subject_sort_link('wr_3', $qstr2, 1) ?><center>건물명</center></th>
<th scope="col" style="padding:0 10px;"><?php echo subject_sort_link('wr_4', $qstr2, 1) ?><center>해당층</center></th>
<th scope="col" style="padding:0 7px;"><?php echo subject_sort_link('wr_5', $qstr2, 1) ?><center>호수</center></th>
<th scope="col" style="padding:0 15px;"><?php echo subject_sort_link('wr_6', $qstr2, 1) ?><center>전용면적</center></th>
<th scope="col" style="padding:0 15px;"><?php echo subject_sort_link('wr_7', $qstr2, 1) ?><center>분양면적</center></th>
<th scope="col" style="padding:0 15px;"><?php echo subject_sort_link('wr_8', $qstr2, 1) ?><center>평당가격</center></th>
<th scope="col" style="padding:0 20px;"><?php echo subject_sort_link('wr_9', $qstr2, 1) ?><center>분양가격</center></th>
<th scope="col" style="padding:0 20px;"><?php echo subject_sort_link('wr_10', $qstr2, 1) ?><center>총분양가</center></th>
<th scope="col" style="padding:0 20px;"><?php echo subject_sort_link('wr_11', $qstr2, 1) ?><center>프리미엄</center></th>
<th scope="col" style="padding:0 25px;"><?php echo subject_sort_link('wr_12', $qstr2, 1) ?><center>매매가격</center></th>
<th scope="col" style="padding:0 25px;"><?php echo subject_sort_link('wr_13', $qstr2, 1) ?><center>보증금</center></th>
<th scope="col" style="padding:0 10px;"><?php echo subject_sort_link('wr_14', $qstr2, 1) ?><center>월세</center></th>
<th scope="col" style="padding:0 10px;"><?php echo subject_sort_link('wr_15', $qstr2, 1) ?><center>임료</center></th>
<th scope="col" style="padding:0 10px;"><?php echo subject_sort_link('wr_16', $qstr2, 1) ?><center>소유자</center></th>
<th scope="col" style="padding:0 20px;"><?php echo subject_sort_link('wr_17', $qstr2, 1) ?><center>연락처</center></th>
<th scope="col"><center>수정</center></th>
</tr>
</thead>
<tbody>
<?php
for ($i=0; $i<count($list); $i++) {
$up_date = date("y/m/d", strtotime($list[$i]['wr_datetime']));
?>
<tr>
<?php if ($is_checkbox) { ?>
<td class="td_chk">
<label for="chk_wr_id_<?php echo $i ?>" class="sound_only"><?php echo $list[$i]['subject'] ?></label>
<input type="checkbox" name="chk_wr_id[]" value="<?php echo $list[$i]['wr_id'] ?>" id="chk_wr_id_<?php echo $i ?>">
</td>
<?php } ?>
<td class="td_num"><?php echo $list[$i]['num'];?></td><!-- 번호 -->
<td class="td_date" title="<?php echo $list[$i]['wr_datetime'] ?>"><a href="<?php echo $list[$i]['href'] ?>"><?php echo $up_date;?></a></td><!-- 등록일 -->
<td class="td_subject"><input type="text" name="wr_subject[]" value="<?php echo $list[$i]['subject'] ?>" id="wr_subject_<?php echo $i ?>" class="lists"></td><!-- 제목 -->
<td class="td_field" title="<?php echo $list[$i]['wr_1'] ?>"><input type="text" name="wr_1[]" value="<?php echo $list[$i]['wr_1'] ?>" id="wr_1_<?php echo $i ?>" class="lists"></td>
<td class="td_field" title="<?php echo $list[$i]['wr_2'] ?>"><input type="text" name="wr_2[]" value="<?php echo $list[$i]['wr_2'] ?>" id="wr_2_<?php echo $i ?>" class="lists"></td>
<td class="td_field" title="<?php echo $list[$i]['wr_3'] ?>"><input type="text" name="wr_3[]" value="<?php echo $list[$i]['wr_3'] ?>" id="wr_3_<?php echo $i ?>" class="lists"></td>
<td class="td_field" title="<?php echo $list[$i]['wr_4'] ?>"><input type="text" name="wr_4[]" value="<?php echo $list[$i]['wr_4'] ?>" id="wr_4_<?php echo $i ?>" class="lists"></td>
<td class="td_field" title="<?php echo $list[$i]['wr_5'] ?>"><input type="text" name="wr_5[]" value="<?php echo $list[$i]['wr_5'] ?>" id="wr_5_<?php echo $i ?>" class="lists"></td>
<td class="td_field" title="<?php echo $list[$i]['wr_6'] ?>"><input type="text" name="wr_6[]" value="<?php echo $list[$i]['wr_6'] ?>" id="wr_6_<?php echo $i ?>" class="lists"></td>
<td class="td_field" title="<?php echo $list[$i]['wr_7'] ?>"><input type="text" name="wr_7[]" value="<?php echo $list[$i]['wr_7'] ?>" id="wr_7_<?php echo $i ?>" class="lists"></td>
<td class="td_field" title="<?php echo $list[$i]['wr_8'] ?>"><input type="text" name="wr_8[]" value="<?php echo $list[$i]['wr_8'] ?>" id="wr_8_<?php echo $i ?>" class="lists"></td>
<td class="td_field" title="<?php echo $list[$i]['wr_9'] ?>"><input type="text" name="wr_9[]" value="<?php echo $list[$i]['wr_9'] ?>" id="wr_9_<?php echo $i ?>" class="lists"></td>
<td class="td_field" title="<?php echo $list[$i]['wr_10'] ?>"><input type="text" name="wr_10[]" value="<?php echo $list[$i]['wr_10'] ?>" id="wr_10_<?php echo $i ?>" class="lists"></td>
<td class="td_field" title="<?php echo $list[$i]['wr_11'] ?>"><input type="text" name="wr_11[]" value="<?php echo $list[$i]['wr_11'] ?>" id="wr_11_<?php echo $i ?>" class="lists"></td>
<td class="td_field" title="<?php echo $list[$i]['wr_12'] ?>"><input type="text" name="wr_12[]" value="<?php echo $list[$i]['wr_12'] ?>" id="wr_12_<?php echo $i ?>" class="lists"></td>
<td class="td_field" title="<?php echo $list[$i]['wr_13'] ?>"><input type="text" name="wr_13[]" value="<?php echo $list[$i]['wr_13'] ?>" id="wr_13_<?php echo $i ?>" class="lists"></td>
<td class="td_field" title="<?php echo $list[$i]['wr_14'] ?>"><input type="text" name="wr_14[]" value="<?php echo $list[$i]['wr_14'] ?>" id="wr_14_<?php echo $i ?>" class="lists"></td>
<td class="td_field" title="<?php echo $list[$i]['wr_15'] ?>"><input type="text" name="wr_15[]" value="<?php echo $list[$i]['wr_15'] ?>" id="wr_15_<?php echo $i ?>" class="lists"></td>
<td class="td_field" title="<?php echo $list[$i]['wr_16'] ?>"><input type="text" name="wr_16[]" value="<?php echo $list[$i]['wr_16'] ?>" id="wr_16_<?php echo $i ?>" class="lists"></td>
<td class="td_field" title="<?php echo $list[$i]['wr_17'] ?>"><input type="text" name="wr_17[]" value="<?php echo $list[$i]['wr_17'] ?>" id="wr_17_<?php echo $i ?>" class="lists"></td>
<td class="td_conf"><span id="flip_<?php echo $i ?>">수정</span></td>
<script>
$(document).ready(function(){
$("#flip_<?php echo $i ?>").click(function(){
var bo_table = "<?=$bo_table?>";
var wr_id = "<?php echo $list[$i]['wr_id'] ?>";
var value0 = $("#wr_subject_<?php echo $i ?>").val();
var value1 = $("#wr_1_<?php echo $i ?>").val();
var value2 = $("#wr_2_<?php echo $i ?>").val();
var value3 = $("#wr_3_<?php echo $i ?>").val();
var value4 = $("#wr_4_<?php echo $i ?>").val();
var value5 = $("#wr_5_<?php echo $i ?>").val();
var value6 = $("#wr_6_<?php echo $i ?>").val();
var value7 = $("#wr_7_<?php echo $i ?>").val();
var value8 = $("#wr_8_<?php echo $i ?>").val();
var value9 = $("#wr_9_<?php echo $i ?>").val();
var value10 = $("#wr_10_<?php echo $i ?>").val();
var value11 = $("#wr_11_<?php echo $i ?>").val();
var value12 = $("#wr_12_<?php echo $i ?>").val();
var value13 = $("#wr_13_<?php echo $i ?>").val();
var value14 = $("#wr_14_<?php echo $i ?>").val();
var value15 = $("#wr_15_<?php echo $i ?>").val();
var value16 = $("#wr_16_<?php echo $i ?>").val();
var value17 = $("#wr_17_<?php echo $i ?>").val();
$.ajax({
type: "POST",
url: "<?php echo $board_skin_url?>/list_up.php",
data: { bo_table:bo_table, wr_id:wr_id, wr_subject:value0, wr_1:value1, wr_2:value2, wr_3:value3, wr_4:value4, wr_5:value5, wr_6:value6, wr_7:value7, wr_8:value8, wr_9:value9, wr_10:value10, wr_11:value11, wr_12:value12, wr_13:value13, wr_14:value14, wr_15:value15, wr_16:value16, wr_17:value17},
success: function () {
//do somthing here
location.reload();
alert("수정되었습니다")
}
});
});
});
</script>
답변 2
number_format(php변수); 하시면 됩니다
number 함수 사용법입니다.
* number_format(): Format a number with grouped thousands. 천단위로 콤마넣는다.
ᆞ문법
number_format($number, $decimals= 0, $deci_point= " . ", $thousand_sep= " , " )
ᆞ예
$number = 1234.567
number_format( $number ) : 1,234 :- 천단위 콤마사용
number_format( $number , 2 ) : 1,234.56 :- 소수점이하 2자리사용
number_format( $number , 3 , ' . ' , ' , ' ) : 1,234.567