db에서 불러오는것좀 문의 드립니다. 정보
db에서 불러오는것좀 문의 드립니다.본문
option_array[0] = new Array("");
option_array[1] = new Array("- 세부상품을 선택하세요 -","test1","test1","test1");
option_array[2] = new Array("- 세부상품을 선택하세요 -","test2","test2");
option_array[3] = new Array("- 세부상품을 선택하세요 -","test3","test3");
option_array[4] = new Array("- 세부상품을 선택하세요 -","test4","test4");
상단은 셀렉터의 스크립트 옵션입니다.
test1,test2,test3... 이렇게 있는부분을 DB에서 불러와야 하는데요.. 숫자가 일정한게 아니고
array[1]이 5개가 될수도 있고 4개가 될수도 있습니다.
array[1]은 po_a 라는 테이블에서 it_num 1~15줄로 되어 있구요 필드명은 title입니다.
array[2]는 po_b 라는 테이블에서 똑같은 형식입니다.
똑같이 array[3] 은 po_c array[3]는 po_d 이구요...
어떤방식으로 어떻게 불러와야 할까요?
지금은 무식한 방법으로
$From = " from po_a";
$i1=sql_fetch("select * $From where it_num='1'");
$i2=sql_fetch("select * $From where it_num='2'");
$i3=sql_fetch("select * $From where it_num='3'");
$i4=sql_fetch("select * $From where it_num='4'");
$i5=sql_fetch("select * $From where it_num='5'");
$i6=sql_fetch("select * $From where it_num='6'");
$i7=sql_fetch("select * $From where it_num='7'");
$i8=sql_fetch("select * $From where it_num='8'");
$i9=sql_fetch("select * $From where it_num='9'");
$i10=sql_fetch("select * $From where it_num='10'");
$i11=sql_fetch("select * $From where it_num='11'");
$i12=sql_fetch("select * $From where it_num='12'");
$i13=sql_fetch("select * $From where it_num='13'");
$i14=sql_fetch("select * $From where it_num='14'");
$i15=sql_fetch("select * $From where it_num='15'");
위의 소스를 사용중인데요..
저걸 간단하게 줄일수 있을까요? 저렇게 총 4개를 만들어서 불러오고 있거든요 ㅜㅜ
option_array[1] = new Array("- 세부상품을 선택하세요 -","test1","test1","test1");
option_array[2] = new Array("- 세부상품을 선택하세요 -","test2","test2");
option_array[3] = new Array("- 세부상품을 선택하세요 -","test3","test3");
option_array[4] = new Array("- 세부상품을 선택하세요 -","test4","test4");
상단은 셀렉터의 스크립트 옵션입니다.
test1,test2,test3... 이렇게 있는부분을 DB에서 불러와야 하는데요.. 숫자가 일정한게 아니고
array[1]이 5개가 될수도 있고 4개가 될수도 있습니다.
array[1]은 po_a 라는 테이블에서 it_num 1~15줄로 되어 있구요 필드명은 title입니다.
array[2]는 po_b 라는 테이블에서 똑같은 형식입니다.
똑같이 array[3] 은 po_c array[3]는 po_d 이구요...
어떤방식으로 어떻게 불러와야 할까요?
지금은 무식한 방법으로
$From = " from po_a";
$i1=sql_fetch("select * $From where it_num='1'");
$i2=sql_fetch("select * $From where it_num='2'");
$i3=sql_fetch("select * $From where it_num='3'");
$i4=sql_fetch("select * $From where it_num='4'");
$i5=sql_fetch("select * $From where it_num='5'");
$i6=sql_fetch("select * $From where it_num='6'");
$i7=sql_fetch("select * $From where it_num='7'");
$i8=sql_fetch("select * $From where it_num='8'");
$i9=sql_fetch("select * $From where it_num='9'");
$i10=sql_fetch("select * $From where it_num='10'");
$i11=sql_fetch("select * $From where it_num='11'");
$i12=sql_fetch("select * $From where it_num='12'");
$i13=sql_fetch("select * $From where it_num='13'");
$i14=sql_fetch("select * $From where it_num='14'");
$i15=sql_fetch("select * $From where it_num='15'");
위의 소스를 사용중인데요..
저걸 간단하게 줄일수 있을까요? 저렇게 총 4개를 만들어서 불러오고 있거든요 ㅜㅜ
댓글 전체

$sql = " select title from po_a where it_num <> 0";
$result = sql_query($sql);
while ($row = sql_fetch_array($result))
{
print_r2($row);
}
$result = sql_query($sql);
while ($row = sql_fetch_array($result))
{
print_r2($row);
}