테스트 사이트 - 개발 중인 베타 버전입니다

list에서 update 하기

· 12년 전 · 816 · 2
안녕하세요 고수님들~~

제가 리스트에서 보여주는 table 필드들입니다.



<td class="num" width="40" align="center"><font size="2"><?=$list[$i][num] + 105 ?></font></td>

<td class="name" width="100" align="center"><font size="2"><?=$list[$i][wr_datetime]?></font></td>

<td class="name" width="100" align="center"><font size="2"><?=$list[$i][wr_11]?></font></td>

<td class="name" width="100" align="center"><font size="2"><?=$list[$i][wr_10]?></font></td>

<td class="name" width="100" align="center"><font size="2"><?=$list[$i][wr_6]?></font></td>

<td class="name" width="100" align="center"><font size="2"><?=$list[$i][wr_2]?></font></td>

<td class="name" width="100" align="center"><font size="2"><?=$list[$i][wr_1]?></font></td>

<td class="name" width="100" align="center"><font size="2"><?=$list[$i][wr_5]?></font></td>

<td class="name" width="100" align="center"><font size="2"><?=$list[$i][wr_4]?></font></td>



저중에서 wr_11부분에 입력 버튼을 클릭하면 버튼을 클릭한 시간이 저장 되게 하고 싶습니다.



<input type="button" name="signature" value="입력" onclick="<? $now = $g4['time_ymdhis'];
sql_query(" update $write_table set $list[$i][wr_11] = '$now'"); ?>



위의 식으로 입력 버튼을 만들었더니 리스트 중 하나만 wr_11에 클릭한 시각이 들어가는 것이 아니라

모든 리스트들의 wr_11필드에 시각이 들어갑니다. 입력버튼을 클릭한 리스트에만 시각이 들어가게

하고 싶습니다.

그리고 list페이지를 새로고침하면 시간이 새로고침한 시간으로 바뀌네여...입력했을 때의 시간이

그대로 있어야 하는 데요....

아 그리고 체크박스 권한을 관리자 외에도 쓸 수 있게 하려면 어떻게 해야 하나요...

어떻게 해야 할까요.....도와주세요^^

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

댓글 2개

12년 전
sql_query(" update $write_table set $list[$i][wr_11] = '$now'");

mysql을 이해를 잘 못하신것같네요
위 쿼리는 $write_table로된 테이블에 $list[$i][wr_11] 로 된 변수 컬럼값에 $now를 넣어라 입니다
이는 * 이부분이 빠져있더라도 모든 $write_table의 $list[$i][wr_11]로 된 모든 컬럼에 값을 넣는게 됩니다.

이부분에다가 where 를 넣어주셔야 해당 게시물만 바뀌게 됩니다
where wr_id={$list[$i][wr_id]} 추가 하면 해당게시물만 들어가겠죠
1

게시글 목록

번호 제목
284255
284248
284247
284246
284242
284238
284234
284233
284229
284224
284222
284215
284213
284212
284209
284208
284201
284193
284192
284174