모든 레벨3 회원이 호출되게 하려면 어떻게해야 하나요?
본문
아래는 레벨3 회원의 아이디를 호출하는 명령어입니다.
<?
$sql2 = "select mb_id from g5_member where mb_level = 3";
$three = sql_fetch($sql2);
$ids2 = "'".implode("','",$three)."'";
echo "$ids2";
?>
이렇게하면 $ids 에 레벨3 회원은 호출이 되는데, 1명만 호출이 됩니다.
모든 레벨3 회원이 호출되게 하려면 어떻게해야 하나요?
도움 부탁 드려요~
답변 2
$three = array();
$sql2 = sql_query("select mb_id from g5_member where mb_level = 3");
while($rows = sql_fetch_array($sql2)) {
$three[] = $rows['mb_id'];
}
$ids2 = "'".implode("', '", $three)."'";
echo $ids2;
$sql2 = "select mb_id from g5_member where mb_level = 3";
$three = sql_query($sql2);
$ids2 = ''
while($row = sql_fetch_array($three)){
if($ids != '') $ids .= ",";
$ids2 = $row['mb_id'];
}
echo "$ids2";
답변을 작성하시기 전에 로그인 해주세요.