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

한개의 컬럼에서 여러값을 불러오기가 안되네요? 채택완료

따라하기 10년 전 조회 3,948

</p><p>function get_size($it_id)
{
    global $g5;</p><p>    $sql1 = "select count(is_size) as cnt1 from {$g5['g5_shop_item_use_table']} where it_id = '$it_id' & is_size = 0";
 $sql2 = "select count(is_size) as cnt2 from {$g5['g5_shop_item_use_table']} where it_id = '$it_id' & is_size = 1";
    $row1 = sql_fetch($sql1);
 $row2 = sql_fetch($sql2);</p><p>    return $row1;
 return $row2;
}</p><p> </p><p>$size1 = get_size(stripslashes($row1['it_id']));
$size2 = get_size(stripslashes($row2['it_id']));</p><p> </p><p>echo $size1['cnt1'];
echo $size2['cnt2'];
​

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

답변 3개

채택된 답변
+20 포인트
10년 전

</strong><span style="font-size: 10pt; line-height: 1.5;">​</span><span style="font-size: 10pt; line-height: 1.5;">function get_size($it_id)</span></p><p>{</p><p>    global $g5;</p><p>    $sql1 = "select count(is_size) as cnt1 from {$g5['g5_shop_item_use_table']} where it_id = '$it_id' & is_size = 0";</p><p>    $sql2 = "select count(is_size) as cnt2 from {$g5['g5_shop_item_use_table']} where it_id = '$it_id' & is_size = 1";</p><p>    $row1['cnt1'] = sql_fetch($sql1);</p><p>    $row1['cnt2'] = sql_fetch($sql2);</p><p>    return $row1;</p><p>}</p><p> </p><p>$size1 = get_size(stripslashes($row1['it_id']));</p><p>$size2 = get_size(stripslashes($row2['it_id']));</p><p> </p><p>echo $size1['cnt1'];</p><p><span style="font-size: 10pt; line-height: 1.5;">echo $size2['cnt2']; </span></p><p><strong style="font-family: 돋움, dotum, helvetica; font-size: 12px; line-height: 21.6000003814697px; background-color: rgb(255, 255, 255);">
 

이렇게 해보시죠

 

로그인 후 평가할 수 있습니다

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

10년 전

슈와이님.. 답변 감사 드리구요..

문제점이 있는데, 실제 값보다 작은 수가 출력 되는군요.

이건 왜이러죠?

로그인 후 평가할 수 있습니다

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

10년 전

Array 로 들어오는 군요.. 값이......

Array 말고 숫자로 들어오는 방법은 없을까요?

로그인 후 평가할 수 있습니다

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

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

로그인