어떤 부분에 문제가 있는 건가요?
본문
어떤 부분에 문제가 있는 건가요?
DB 에는 값이 있으나, 출력이 되지 않습니다.
shop.lib.php
function get_color1($it_id)
{
global $g5;
$sql = "select count(is_color) as color1 from {$g5['g5_shop_item_use_table']} where it_id = '$it_id' and is_color='6' ";
$row = sql_fetch($sql);
return (int)$row['color1'];
}
item.php
$color1 = get_color1($it['it_id']);
item.form.skin.php
<?php if ($color1) {
echo $color1?>명
<?php } ?>
답변 3
id값이 나온다면 원인은 쿼리문에 있겠죠
global $g5; 다음줄에 아래 코드를 넣어서 출력이 있는지 보세요
$qq=sql_query("select is_color from {$g5['g5_shop_item_use_table']} where it_id = '$it_id' and is_color='6' ");
while($row = sql_fetch_array($qq)) echo '<br>'.$row[is_color];
$color1 = get_color1($it['it_id']); 위치가 $it 값을 구하기 이전이라면 넘겨주는 값이 없을 수도 있겠죠
echo $it['it_id'].'///////////////////'; <---이걸 넣어서 출력되는지 확인 또는 $it_id 사용
id가 출력 됩니다.