insert 문으로 게시글을 올리는데, 글번호가 증가하지 않습니다. 좀 도와주세요.. 정보
insert 문으로 게시글을 올리는데, 글번호가 증가하지 않습니다. 좀 도와주세요..본문
write.skin.php를 이용해서
새로운 게시글을 올리면 정상적으로 게시글번호가 +1씩 증가합니다.
그런데
현재 게시판의 올린글의 마지막 번호가 500 이라면
새글은 501번이 되어야하는데..
아래 insert 로 하면 새글이 500번이 되고 나머지 기존글은 번호가 -1 씩 됩니다.
이거 정상적으로 글번호가 +1씩 증가하게 하려면 어떻게해야 할까요?
~~
$sql = "select min(wr_num) as min_wr_num from g4_write_gnuboard_customer";
$rst = @mysql_query($sql);
$row=mysql_fetch_array($rst);
$wr_num = (int)($row[min_wr_num]-1);
$query="insert into g4_write_gnuboard_customer set
wr_num=$wr_num,
wr_reply='',
wr_parent='',
wr_is_comment=0,
wr_comment=0,
wr_option='secret',
wr_subject='test',
wr_content='$test',
wr_link1_hit=0,
wr_link2_hit=0,
wr_hit=0,
wr_good=0,
wr_nogood=0,
wr_password='',
wr_name='$name',
wr_email='',
wr_homepage='',
wr_datetime='$tdate',
wr_last='$tdate'";
mysql_query($query,$connect);
$wr_id=mysql_insert_id();
$qry="update g4_write_gnuboard_customer set
wr_parent=$wr_id
where wr_id=$wr_id";
mysql_query($qry);
~~
새로운 게시글을 올리면 정상적으로 게시글번호가 +1씩 증가합니다.
그런데
현재 게시판의 올린글의 마지막 번호가 500 이라면
새글은 501번이 되어야하는데..
아래 insert 로 하면 새글이 500번이 되고 나머지 기존글은 번호가 -1 씩 됩니다.
이거 정상적으로 글번호가 +1씩 증가하게 하려면 어떻게해야 할까요?
~~
$sql = "select min(wr_num) as min_wr_num from g4_write_gnuboard_customer";
$rst = @mysql_query($sql);
$row=mysql_fetch_array($rst);
$wr_num = (int)($row[min_wr_num]-1);
$query="insert into g4_write_gnuboard_customer set
wr_num=$wr_num,
wr_reply='',
wr_parent='',
wr_is_comment=0,
wr_comment=0,
wr_option='secret',
wr_subject='test',
wr_content='$test',
wr_link1_hit=0,
wr_link2_hit=0,
wr_hit=0,
wr_good=0,
wr_nogood=0,
wr_password='',
wr_name='$name',
wr_email='',
wr_homepage='',
wr_datetime='$tdate',
wr_last='$tdate'";
mysql_query($query,$connect);
$wr_id=mysql_insert_id();
$qry="update g4_write_gnuboard_customer set
wr_parent=$wr_id
where wr_id=$wr_id";
mysql_query($qry);
~~
Fatal error: Uncaught TypeError: mysqli_fetch_assoc(): Argument #1 ($result) must be of type mysqli_result, null given in /home/kagla/new-sir/old/lib/common.lib.php:2339 Stack trace: #0 /home/kagla/new-sir/old/lib/common.lib.php(2339): mysqli_fetch_assoc() #1 /home/kagla/new-sir/old/skin/board/v16/view.skin.php(795): sql_fetch_array() #2 /home/kagla/new-sir/old/bbs/view.php(403): include_once('...') #3 /home/kagla/new-sir/old/bbs/board.php(300): include_once('...') #4 {main} thrown in /home/kagla/new-sir/old/lib/common.lib.php on line 2339