HELP ALL ASP PROGRAMMERS!!!

ASP sucks! PHP is rocks!

PM me is you need help though... I know a few decent ASP programmers.
 
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

 
Can you give a better description of what you are wanting?
 
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
 
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
 

Similar threads

Replies
2
Views
599
Replies
3
Views
751
Replies
4
Views
927
Replies
24
Views
2K