글이 없으면 1 있으면....

글이 없으면 1 있으면....

QA

글이 없으면 1 있으면....

답변 2

본문

게시판에서 회원의 글이 없으면 1

있으면 글갯수 +1을 하려는데

 

<?php
$result = sql_query("select number, wr_datetime from g5_write_acco where mb_id='$write[mb_id]' and wr_is_comment ='0' order by wr_num  limit 1 , 1"); 
 if(!sql_num_rows($result)){ //------------------- 없으면 

  $row['cnt'] = 1; 

} else {

  $result = $row['cnt'] +1;
}
?>

<?php echo $row['cnt'];?>

 

이렇게 하니 애러나는데 무엇이 잘못되었을까요?

 

오늘도 열심히 공부 및 삽질중입니다,

 

없으면 

이 질문에 댓글 쓰기 :

답변 2


<?php
$result = sql_query("select wr_id, wr_datetime from g5_write_acco where mb_id='{$write['mb_id']}' and wr_is_comment ='0' order by wr_num  limit 1 , 1"); 
 if(!sql_num_rows($result)){ //------------------- 없으면 
  $row['cnt'] = 1; 
} else {
  $result = $row['cnt'] +1;
}
?>
<?php echo $row['cnt'];?>

<?php
$result = sql_query("select number, wr_datetime from g5_write_acco where mb_id='".$write['mb_id']."' and wr_is_comment ='0' order by wr_num  limit 1 , 1"); 
 if(!sql_num_rows($result)){ //------------------- 없으면 
  $row['cnt'] = 1; 
} else {
  $result = $row['cnt'] +1;
}
?>

이런식으로 처리해 보시면 되실듯 합니다.
답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 10
© SIRSOFT
현재 페이지 제일 처음으로