mysql 설명 좀 해주세요.
$QUERY = "select * from g4_category where c_depth='0' order by c_sort asc";
$RESULT = mysql_query($QUERY);
where 가 무슨뜻인지???
<?
$QUERY2 = "select * from g4_category where c_depth='1' and c_pcode='$LIST[c_code]' order by c_name asc";
$RESULT2 = mysql_query($QUERY2);
?>
<?
while($LIST2 = mysql_fetch_array($RESULT2))
{
?>
<?= $LIST2[c_code]?>
<?=$LIST2[c_name]?>
<?=date("Y-m-d",strtotime($LIST2[c_regday]))?>
<?
}
?>
위의 c_depth='1' and c_pcode='$LIST[c_code]' 은 무슨뜻인가요? c_depth='1' 값과 c_pcode='$LIST[c_code]' 값을 c_name이름으로 정렬하는건가요?
근데 c_pode='$LIST[c_code]' 은 무슨말인지?? 다른거와 다르게 [] 이 있는데 공부 중이니깐 상세히 좀 알려주시면 감사하겠습니다.
제가 위의 소스로 페이지를 만들면 출력이되어야 하는데 오류가 나네요~ 알려주세요 ^^
$RESULT = mysql_query($QUERY);
where 가 무슨뜻인지???
<?
$QUERY2 = "select * from g4_category where c_depth='1' and c_pcode='$LIST[c_code]' order by c_name asc";
$RESULT2 = mysql_query($QUERY2);
?>
<?
while($LIST2 = mysql_fetch_array($RESULT2))
{
?>
<?= $LIST2[c_code]?>
<?=$LIST2[c_name]?>
<?=date("Y-m-d",strtotime($LIST2[c_regday]))?>
<?
}
?>
위의 c_depth='1' and c_pcode='$LIST[c_code]' 은 무슨뜻인가요? c_depth='1' 값과 c_pcode='$LIST[c_code]' 값을 c_name이름으로 정렬하는건가요?
근데 c_pode='$LIST[c_code]' 은 무슨말인지?? 다른거와 다르게 [] 이 있는데 공부 중이니깐 상세히 좀 알려주시면 감사하겠습니다.
제가 위의 소스로 페이지를 만들면 출력이되어야 하는데 오류가 나네요~ 알려주세요 ^^
|
댓글을 작성하시려면 로그인이 필요합니다.
댓글 1개
데이타베이스의 DML 문은 select,update,insert 문으로 구성이 되는데요
그중 select 문의 구성은 select 칼럼 from 테이블 where 조건 으로 구성됩니다.
따라서 제일 위에 적으신 where 은 조건문이 되는거죠
위에 조건문을 한글로 바꾸면 c_depth 이 0 인 값을 가져와라 란 의미가 됩니다.
그와 마찬가지로 c_depth='1' and c_pcode='$LIST[c_code]' 이부분 또한
c_depth 칼럼값이 1 이고 c_pcode 가 $list[c_code] 인 것을 가져와라
란 의미가 됩니다.
$list[c_code] 는 list 배열에서 c_code 값을 가져온다는 의미이고요
이와같이 처리하기 위해 mysql 의 mysql_fetch_array 함수를 이용합니다.
php 책을 조금 보시는게 도움이 되실듯 합니다.