채택완료

이걸 한번에 배열로 봅는 방법

2014-04-07 (월) 21:57:30 6,647
$st=sql_fetch("select wr_content from g4_write_mb28 where wr_id='12' ");
$st3=sql_fetch("select wr_content from g4_write_mb28 where wr_id='13' ");
$st4=sql_fetch("select wr_content from g4_write_mb28 where wr_id='14' ");
$st5=sql_fetch("select wr_content from g4_write_mb28 where wr_id='15' ");
 
이런쿼리를 한번에 뽑아 배열로 담을 라면 어떤 쿼리를 쓰는게 맞을까요?
 
union ?
or?
 
 
|

답변 2개

채택된 답변
+20 포인트
2014-04-07 (월) 23:10:38
select wr_content from g4_write_mb28 where wr_id BETWEEN 12 AND 15
 
select wr_content from g4_write_mb28 where wr_id>11 AND wr_id<16
 
 
 
 
무식한 방법으로 - 이건 띄엄띄엄 있을때 사용하고요.
select wr_content from g4_write_mb28 where wr_id=11 OR wr_id=12 OR wr_id=13 OR wr_id=14 OR wr_id=15
$sql_no = " select wr_content from g4_write_mb28 where wr_id BETWEEN 12 AND 15 ";
$qry = sql_query($sql_no);
while ($row = sql_fetch_array($qry)) {
 $noti[] = $row;
}
 
$noti[0][wr_content]
$noti[1][wr_content]
$noti[2][wr_content]
$noti[3][wr_content]
 
이렇게 해결했습니다.........감사드립니다 ^^ ㅎㅎ
 

답변을 작성하려면 로그인이 필요합니다.