한 게시글의 코멘트 부분에
Copy
<?$re_result = sql_query("select * from {$g5['inventory_table']} inven, {$g5['item_table']} it where inven.ch_id = '{$character['ch_id']}' and it.it_use_recepi = 1 and inven.it_id = it.it_id"); ?>
<? for($i=0; $re_row = sql_fetch_array($re_result); $i++) { ?>
<option value="<?=$re_row['in_id']?>">
<?=$re_row['it_name']?>
</option>
<? } ?>
를 사용했는데
이전 게시글이 안 불러와집니다.
위 코드에서 for문을 제거하면 다시 불러와지네요... 왜 그럴까요?
답변 3개 / 댓글 6개
채택된 답변
+20 포인트
Copy
<?php
$re_result = sql_query("SELECT * FROM {$g5['inventory_table']} inven, {$g5['item_table']} it WHERE inven.ch_id = '{$character['ch_id']}' AND it.it_use_recepi = 1 AND inven.it_id = it.it_id");
for($i=0; $re_row = sql_fetch_array($re_result); $i++) {
?>
<option value="<?php echo $re_row['in_id']?>">
<?php echo $re_row['it_name']?>
</option>
<?php } ?>
답변에 대한 댓글 4개
sinbi
1년 전
아래 함수로 각 배열변수의 내용을 확인하면서 점검해 보세요.
var_dump()
print_r()
print_r2()
var_dump()
print_r()
print_r2()
nyaro
1년 전
for문 대신 while문 사용으로 해결했습니다. 답변 주셔서 넘 감사해요.
아직은 for문을 사용하면 왜 안되는지는 모르겠네요..
아직은 for문을 사용하면 왜 안되는지는 모르겠네요..
for문 대신 while문 사용으로 해결했습니다 .. 왜 for문을 사용하면 안되는지는 모르겠네요..
답변에 대한 댓글 1개
1년 전
$re_row[$i]['in_id']
이런식으로 해보세요
답변에 대한 댓글 1개
답변을 작성하려면 로그인이 필요합니다.