Creating your own ASP Blog
The web has blog fever. You can easily create your very own blog for your website with use of ASP and SQL. Keep your visitors up to date with what's going on in your world!
Your first task of course is to make the table that will hold your blog entries. In your chosen SQL database, create a table called BLOG with the fields
blog_id
blog_date
blog_title
blog_text
Make blog_id the key. Now, make an Add page for yourself, that lets you add blog entries. You'll create a blog_add.asp file. Really, all this page has to to do is have a form where you enter a title and text. Use standard form language to do this - and have it go to blog_add_p.asp for processing.
In blog_add_p.asp, you use request to get those fields, and Now() to get the current date. Next, you use a SELECT MAX() to find the current blog_id from the table, and add 1 to it. Use an INSERT command to write in your brand new blog entry to the table.
Now for your viewers, it's pretty simple. Use the SELECT blog_title, blog_text, blog_date from blog order by blog_id DESC to get the latest blog entry, and show it on the screen. You can even show previous blog entries, based on the blog_id.
If you're not familiar with these basic ASP commands, be sure to read through my site - I lay out explicit details on how to do each one!
Your first task of course is to make the table that will hold your blog entries. In your chosen SQL database, create a table called BLOG with the fields
blog_id
blog_date
blog_title
blog_text
Make blog_id the key. Now, make an Add page for yourself, that lets you add blog entries. You'll create a blog_add.asp file. Really, all this page has to to do is have a form where you enter a title and text. Use standard form language to do this - and have it go to blog_add_p.asp for processing.
In blog_add_p.asp, you use request to get those fields, and Now() to get the current date. Next, you use a SELECT MAX() to find the current blog_id from the table, and add 1 to it. Use an INSERT command to write in your brand new blog entry to the table.
Now for your viewers, it's pretty simple. Use the SELECT blog_title, blog_text, blog_date from blog order by blog_id DESC to get the latest blog entry, and show it on the screen. You can even show previous blog entries, based on the blog_id.
If you're not familiar with these basic ASP commands, be sure to read through my site - I lay out explicit details on how to do each one!
Related Articles
Editor's Picks Articles
Top Ten Articles
Previous Features
Site Map
Content copyright © 2023 by Lisa Shea. All rights reserved.
This content was written by Lisa Shea. If you wish to use this content in any manner, you need written permission. Contact Lisa Shea for details.