1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

HELP ALL ASP PROGRAMMERS!!!

Discussion in 'General Chat' started by richy, Sep 4, 2004.

  1. richy
    Offline

    richy Member

    Joined:
    Feb 18, 2004
    Messages:
    892
    Likes Received:
    0
    [Sep 4, 2004]
    if your spot on with ASP please PM me.. having major problems with database paging.... /ubbthreads/images/graemlins/frown.gif


    #1
  2. Ads

    Ads

    [Dec 19, 2014]

  3. Grant
    Offline

    Grant Well-Known Member VCDS Map User

    Joined:
    Dec 4, 2003
    Messages:
    1,161
    Likes Received:
    60
    [Sep 7, 2004]
    ASP sucks! PHP is rocks!

    PM me is you need help though... I know a few decent ASP programmers.
    #2
  4. richy
    Offline

    richy Member

    Joined:
    Feb 18, 2004
    Messages:
    892
    Likes Received:
    0
    [Sep 7, 2004]
    asp is alot better for what i need it for..

    need a database paging script that actually works instead of the carp examples you get on websites..that dont work.. lol

    #3
  5. Grant
    Offline

    Grant Well-Known Member VCDS Map User

    Joined:
    Dec 4, 2003
    Messages:
    1,161
    Likes Received:
    60
    [Sep 7, 2004]
    Can you give a better description of what you are wanting?
    #4
  6. richy
    Offline

    richy Member

    Joined:
    Feb 18, 2004
    Messages:
    892
    Likes Received:
    0
    [Sep 7, 2004]
    ok heres what i have at the moment.

    this script shows alllll the data in the table.

    the fields are as follows

    SubTitle= Request.Form("SubTitle")
    Topic = Request.Form("Topic")
    SubPicThumb = Request.Form("SubPicThumb")
    SubIntro = Request.Form("SubIntro")
    SubDate = Request.Form("SubDate")
    SubSplash = Request.Form("SubSplash")
    SubMain = Request.Form("SubMain")
    SubKeyword = Request.Form("SubKeyword")

    the script to show all is

    ###########################

    <%
    'declare your variables




    'create an ADO connection and recordset object
    Set Conn = Server.CreateObject("ADODB.Connection")
    Set Recordset = Server.CreateObject("ADODB.Recordset")





    'declare your SQL statement that will query the database
    sSQL = "SELECT * FROM articles"

    'define the connection string, specify database driver and the location of the database
    sConnString = "DRIVER={Microsoft Access Driver (*.mdb)};" & _
    "DBQ=" & Server.MapPath("/db/vagdb.mdb") & ";"




    'Open the recordset object executing the SQL statement and return records

    conn.Open sConnString

    recordset.Open sSQL,conn


    'first of all determine whether there are any records
    If Recordset.EOF Then
    Response.Write("No records returned.")
    Else
    'if there are records then loop through the fields
    Do While Not recordset.EOF


    Response.Write("<p><table width=537 cellpadding=0 cellspacing=0 border=0 align=center><tr><td width=3 rowspan=5></td><td width=100 align=center rowspan=5><img src=" & recordset("SubPicThumb") & " border=1 bordercolor=#000000></td><td width=3 align=center rowspan=2></td><td width=294 valign=top><font face=verdana size=1 color=#999999> <b><font face=verdana size=1 color=#999999>[</font></b><a href=" & recordset("Topic") & "/><b><font face=verdana size=1 color=#999999>" & recordset("Topic") & "</font></b></a><b><font face=verdana size=1 color=#999999>]</font></b> <a href=article.asp?keyword=" & recordset("SubKeyword") & "><b><font face=verdana size=1 color=#999999>" & recordset("SubTitle") & "</b></font></a></td></tr><tr><td><font face=verdana size=1 color=#999999>" & recordset("SubIntro") & "</font></td></tr><tr><td height=2></td></tr><tr><td align=right colspan=2><font face=verdana size=1 color=#999999>" & recordset("SubDate") & " </font></td></tr><tr><td height=2></td></tr></table></p>")



    'move on to the next record
    Recordset.MoveNext

    loop

    end if


    'close the connection and recordset objects and free up resources
    Recordset.Close
    Set Recordset = Nothing
    Conn.Close
    Set Conn = Nothing
    %>


    ######################

    now i want it to show 5 records and then at the bottom of the 5 records show pages 1,2,3,4 obviously depending on how many records there are. its something they use on all the search engine when over there are loads of results.. also i want only the 5 to be collected and then when u click 'page 2' is then collects them.. i dont want the script to collect all the data from the table as i want it as quick as possible.


    hope this explains what im after.. :p
    #5
  7. Grant
    Offline

    Grant Well-Known Member VCDS Map User

    Joined:
    Dec 4, 2003
    Messages:
    1,161
    Likes Received:
    60
    [Sep 8, 2004]
    If you only want to collect the first 5 records, then use the MySQL statement:

    SELECT * FROM articles LIMIT 5

    You'll also need to find out how many records you have and do a calculation of total records divided by 5 and round it up - that how many pages you'll have.

    SELECT COUNT(*) FROM articles

    or

    SELECT COUNT(*) AS totalrecords FROM articles
    #6
  8. richy
    Offline

    richy Member

    Joined:
    Feb 18, 2004
    Messages:
    892
    Likes Received:
    0
    [Sep 8, 2004]
    humm... will have a blast tonight....
    #7

Share This Page