Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
Like Tree1Likes

Thread: blog

  1. #1
    Junior Member
    Join Date
    Sep 2017
    Location
    Norway
    Posts
    14
    Member #
    57412
    Liked
    1 times

    Question blog

    Hello. I am trying to make a blog on my website with ten categories, I am using access database and this site are build in old asp 3.0 with vbscript. So I am struggling with this, because I can find out how I shal do it with comment field? I try to show all the comments under each post, but it does't work out for me. If I try this, just one post will be show there? How I can find a good codes for this in vbscript? I will be very greatful for all help I can got from you here!

  2.  

  3. #2
    Junior Member SoftLink's Avatar
    Join Date
    Sep 2017
    Location
    Central Florida
    Posts
    24
    Member #
    57480
    Boy, that takes me back to the beginning of server side technology and using databases.
    This is the first way I ever developed database driven Web pages.
    That was a looooong time ago

    I don't know why you'd want to do it this way. Now WordPress is the best solution for a blog.
    Here is a simple ASP Web page that calls an Access database and displays multiple records from that database.
    Code:
    <%
    Option Explicit
    Dim oCn, rsRecs
    
    getConn()
    getRecords()
    
    sub getConn()
    	set oCn=Server.CreateObject("ADODB.Connection")
    	oCn.Provider="Microsoft.Jet.OLEDB.4.0"
    	oCn.Open(Server.Mappath("DataAccess/northwind.mdb"))
    end sub
    sub getRecords()
    	set rsRecs = Server.CreateObject("ADODB.recordset")
    	rsRecs.Open "SELECT Companyname, Contactname FROM Customers", oCn
    end sub
    %>
    
    <table border="1" width="100%">
    <%do until rsRecs.EOF%>
        <tr>
        	<td><%= rsRecs.fields("Companyname")%>&nbsp;&nbsp;</td><td><%= rsRecs.fields("Contactname")%>&nbsp;&nbsp;</td>
        </tr>
        <%next
        rsRecs.MoveNext%>
        </tr>
    <%loop
    rsRecs.close
    oCn.close
    %>
    </table>
    
    </body>
    </html>

    ----------------------------------------------------------------------------------------------------------------
    Business Software • Database • Internet • Websites
    Web Designers: Need some heavy lifting done?
    http://www.softlinksys.com
    Last edited by SoftLink; Oct 30th, 2017 at 06:37 AM.

  4. #3
    Junior Member
    Join Date
    Sep 2017
    Location
    Norway
    Posts
    14
    Member #
    57412
    Liked
    1 times
    Oh, THANK YOU SO VERY MUCH, I will try it this way. I don't wnat to use Wordpress, because I want this to be included in my asp site...

  5. #4
    Junior Member
    Join Date
    Sep 2017
    Location
    Norway
    Posts
    14
    Member #
    57412
    Liked
    1 times
    I tried this code, but I got a message about Option Explicit? What I do wrong? I also wounder about how I shall show answers / comments under each blog? Thanks a lot for your help!

  6. #5
    Junior Member SoftLink's Avatar
    Join Date
    Sep 2017
    Location
    Central Florida
    Posts
    24
    Member #
    57480
    I'm sorry, I can't test that code. Neither of my Web hosts nor my test computer can run classic asp.
    You can remove the Option Explicit. I expect that you will get another error.
    From there we can debug the problem.

    As far as comments are concerned you just need to add a form for them and then enter that data into the database; maybe make a table 'comments'. Then to retrieve & display the comments you can just do the same thing as the code I wrote for you.

    ----------------------------------------------------------------------------------------------------------------
    Business Software • Database • Internet • Websites
    Web Designers: Need some heavy lifting done?
    http://www.softlinksys.com
    Last edited by SoftLink; Oct 30th, 2017 at 06:40 AM.

  7. #6
    Junior Member
    Join Date
    Sep 2017
    Location
    Norway
    Posts
    14
    Member #
    57412
    Liked
    1 times
    Okay my friend, I will try.
    Thanks a lot!!!

  8. #7
    Junior Member
    Join Date
    Sep 2017
    Location
    Norway
    Posts
    14
    Member #
    57412
    Liked
    1 times
    But why I get this message when I try this?

    Microsoft VBScript compilation error '800a041f'

    Unexpected 'Next'

    /bloggen/list_bloggen.asp, line 24

    next
    ^

  9. #8
    Junior Member
    Join Date
    Sep 2017
    Location
    Norway
    Posts
    14
    Member #
    57412
    Liked
    1 times
    Hello again, my frtiend. Thanks a lot for all your help!!!
    I delete the NEXT and now it's work good... Thanks!

    I just wantt to know if it's possible to show each comment for the correct blog under this text? Like facebook for example.

    Text 1....
    Comment for this text 1.

    text 2 ....
    Comments for text 2... etc...

  10. #9
    Junior Member SoftLink's Avatar
    Join Date
    Sep 2017
    Location
    Central Florida
    Posts
    24
    Member #
    57480
    ACK! that next was a bug.
    There's an extra <tr> tag in there too.
    Sorry about that.

    You can pretty easily add comments for a given 'article'.
    Write a function to pull all comments into an array. I generally have an ID for each record.
    As you're looping through the articles displaying them you can loop through the 'comments' array a display all comments with the matching 'ArticleID'.
    Alternatively, as you're looping through the articles call a function to query the database for just the comments for that article and then display that recordset.

    So, you'd have a loop (the comments) inside another loop (the articles).

    -------------------------------------------------------------------------------------------------------------------------------
    Business Software • Database • Internet • Websites
    Web Designers: Need some heavy lifting done?
    SoftLink Systems

  11. #10
    Junior Member
    Join Date
    Sep 2017
    Location
    Norway
    Posts
    14
    Member #
    57412
    Liked
    1 times
    You know what my friend, I will say thank you so very much... BECAUSE, NOW IT'S WORK PERFECT HERE!!!
    SoftLink likes this.


Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 02:42 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com