감히 부끄러운 질문 하나 하겠습니다 ㅠ,ㅠ array에서 원하는 것 출력하기 채택완료
amkor
10년 전
조회 3,455
어느 한 변수를 출력해보았는데요
</p><p>array(2) {</p><p> ["oname"]=></p><p> string(39) "324234234.jpg"</p><p> ["sname"]=></p><p> string(18) "2342323234234.jpg"</p><p>} </p><span style="font-size: 14.6666669845581px; line-height: 1.5;">array(2) {</span><p style="font-size: 14.6666669845581px;"> ["oname"]=></p><p style="font-size: 14.6666669845581px;"> string(39) "324232334234.jpg"</p><p style="font-size: 14.6666669845581px;"> ["sname"]=></p><p style="font-size: 14.6666669845581px;"> string(18) "2342323234234.jpg"</p><p><span style="font-size: 14.6666669845581px; line-height: 1.5;">}</span></p><p><span style="font-size: 14.6666669845581px; line-height: 1.5;">array(2) {</span></p><p style="font-size: 14.6666669845581px;"> ["oname"]=></p><p style="font-size: 14.6666669845581px;"> string(39) "3242312314234.jpg"</p><p style="font-size: 14.6666669845581px;"> ["sname"]=></p><p style="font-size: 14.6666669845581px;"> string(18) "23133.jpg"</p><p><span style="font-size: 14.6666669845581px; line-height: 1.5;">}</span> </p><p><span style="font-size: 14.6666669845581px; line-height: 1.5;"></span><span style="font-size: 14.6666669845581px; line-height: 1.5;">array(2) {</span></p><p style="font-size: 14.6666669845581px;"> ["oname"]=></p><p style="font-size: 14.6666669845581px;"> string(39) "12313.jpg"</p><p style="font-size: 14.6666669845581px;"> ["sname"]=></p><p style="font-size: 14.6666669845581px;"> string(18) "2221312313.jpg"</p><p><span style="font-size: 14.6666669845581px; line-height: 1.5;">}</span><span style="font-size: 14.6666669845581px; line-height: 1.5;"> </span></p><p> </p><p>
여기서 반복적으로 보이는데 여기서 한 array에서 sname 만 출력하고 싶은데
$변수[0][sname];
이렇게 하면 되는거 아닌가요 ㅠ,ㅠ
php 초보 입니다 ㅠㅍ, 고수님들 너그럽게 봐주세요 ㅠ,ㅠ 죄송합니다 ㅠ,ㅠ
댓글을 작성하려면 로그인이 필요합니다.
답변 2개
채택된 답변
+20 포인트
10년 전
while 문으로 돌리고 변수이름에 숫자 인덱스가 없는듯 보이네요..
$변수[sname]; 으로 해보세요.
mysql_fetch_row 로 fetch 했다면
$변수[sname][0];
로그인 후 평가할 수 있습니다
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인