Learn to make a message book step by step-add wonderful messages
Source: Internet
Author: User
When one day you see a wonderful message in your message book's message record, will you consider displaying the messages on a separate page to introduce them to your friends, what makes it easier for more netshers to see? If this is the case, you will be able to get your wish if you have read this chapter.
You can add the "add wonderful message" function to the message book in three steps.
Virtual host
Step 1: First, create a new data table (such as perfect) for storing wonderful messages in the message database ).
Because the structure of the data table used to store wonderful messages is the same as that of the data table used to store messages, the easiest way to create a perfect data table is to COPY the structure of the guestbook, paste and confirm. As shown in the following figure:
Step 2: compile the "add wonderful message" message processing program (wonderful. asp ).
<! -- # Include file = "adovbs. inc" -->
<! -- # Include file = "post. asp" -->
<% ID = Request. Querystring ("ID") %>
<%
Set conn = Server. CreateObject ("ADODB. Connection ")
DBPath = Server. MapPath ("book2.mdb ")
Conn. Open "driver = {Microsoft Access Driver (*. mdb)}; dbq =" & DBPath
SQL = "DELETE * FROM perfect WHERE (ID =" & Request. QueryString ("id") & ")" Set rs = conn. Execute (SQL)
SQL = "insert into perfect select * from guestbook where (ID =" & Request. QueryString ("id ")&")"
Set rs = conn. Execute (SQL)
%>
'To avoid the error that occurs when we repeatedly repeat a message during the operation of "add wonderful message", we can ignore the error, first, select ID = "& Request. the QueryString ("id") & "message records are deleted, and the ID =" & Request. the QueryString ("id") & "message is inserted into the perfect data table.
Step 3: Design the page (post. asp) that is transferred after the message is added to the wonderful message data table ).
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.