ql_connect("localhost", "root", "abc123")
or die("Could not connect
");
$select = mysql_select_db ("guestbook");
if (!$select) {
echo "";
echo "데이타베이스 선택시 오류가 발생하였습니다.";
echo "";
exit;
}
$query = "select * from guestbook where idxnum = $idxnum";
$result = mysql_query($query);
if (!$result) {
echo "";
echo "질의 수행시 오류가 발생하였습니다.";
echo "";
exit;
}
$count = 0;
$rowcnt = mysql_num_rows($result);
if ($rowcnt!= 1) {
echo "Error
";
exit;
}
$row = mysql_fetch_row($result);
$view = intval($row[9]);
$view++;
$updatesql = "update guestbook set view = $view where idxnum = $idxnum";
$result = mysql_query($updatesql);
if (!$result) {
echo "";
echo "update문 수행시 오류가 발생하였습니다.";
echo "";
exit;
}
echo "
| 글번호 | $row[0] |
| 작성자 | $row[1] |
| IP 주소 | $row[5] |
| 작성 날짜/시간 | $row[4] |
| 글내용 |
".ereg_replace("\n", " ", $row[3])." |