왜 DB에 있는 값하고 틀리게 출력되죠..
DB의 값을 아무리 수정해도 무조건 11 11 11 이렇게 뜨는데...
이유가 뭘까요?
Copy
function get_color_high($it_id){ global $g5; $sql = "select count(is_color_high) as cnt from {$g5['g5_shop_item_use_table']} where it_id = '$it_id'"; $row = sql_fetch($sql); return $row;}function get_color_medium($it_id){ global $g5; $sql = "select count(is_color_medium) as cnt from {$g5['g5_shop_item_use_table']} where it_id = '$it_id'"; $row = sql_fetch($sql); return $row;}function get_color_small($it_id){ global $g5; $sql = "select count(is_color_small) as cnt from {$g5['g5_shop_item_use_table']} where it_id = '$it_id'"; $row = sql_fetch($sql); return $row;}function get_size_high($it_id){ global $g5; $sql = "select count(is_size_high) from {$g5['g5_shop_item_use_table']} where it_id = '$it_id'"; $row = sql_fetch($sql); return $row;}function get_size_medium($it_id){ global $g5; $sql = "select count(is_size_medium) from {$g5['g5_shop_item_use_table']} where it_id = '$it_id'"; $row = sql_fetch($sql); return $row;}function get_size_small($it_id){ global $g5; $sql = "select count(is_size_small) from {$g5['g5_shop_item_use_table']} where it_id = '$it_id'"; $row = sql_fetch($sql); return $row;} $color_high = get_color_high($row['it_id']);$color_medium = get_color_medium($row['it_id']);$color_small = get_color_small($row['it_id']);$size_high = get_size_high($row['it_id']);$size_medium = get_size_medium($row['it_id']);$size_small = get_size_small($row['it_id']); if($color_high || $color_medium || $color_small || $size_high || $size_medium || $size_small) { echo $color_high['cnt'] echo $color_medium['cnt'] echo $color_small['cnt'] echo $size_high['cnt'] echo $size_medium['cnt'] echo $size_small['cnt'] }
답변 2개
2015-02-23 (월) 15:55:29
SQL 을 보면 $it_id 값을 가진 컬럼의 열 갯수를 구하신거 같습니다.
정확하게 DB 안에 값을 뽑아내는건지 아님 갯수를 원하시는지 질묵을 좀더 정확하게 하시는게 좋을거 같습니다.
제가 파악하기로는 질문자님께서 DB안에 값을 뽑아내길 원하시는걸로 파악했습니다.
2015-02-23 (월) 12:38:38
if($color_high || $color_medium || $color_small || $size_high || $size_medium || $size_small) {
echo "1 : ". $color_high['cnt']
echo "2 : ".$color_medium['cnt']
echo "3 : ".$color_small['cnt']
echo "4 : ".$size_high['cnt']
echo "5 : ".$size_medium['cnt']
echo "6 : ".$size_small['cnt']
}
이렇게 해보세요
값이 있는지 없는지 부터 확인해봐야겠죠
답변을 작성하려면 로그인이 필요합니다.