Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Horizontal Search Results.

Status
Not open for further replies.

Jouster

Programmer
Dec 4, 2000
82
US
Hi,

I would like to show my search results in a horizontal "way" across the page about 4 items per row. I've been trying to come up with the ASP code to do this but can't seem to get it right. Has anyone done this and have some example code?

Thanks,
Rick
 
something like this maybe?? coding is very much open to criticism :)

Code:
Response.Write &quot;<TABLE WIDTH=600 COLS=4 CELLSPACING=0 CELLPADDING=0 BORDER=0>&quot; & vbcrlf

intCount = 0

While NOT objResultsRS.EOF
  intCount = intCount + 1

  If intCount = 1 Then
    Response.Write &quot;<TR>&quot; & vbcrlf
  ElseIf intCount = 4 Then
    Response.Write &quot;</TR>&quot; & vbcrlf & &quot;<TR>&quot; & vbcrlf
    intCount = 0
  End If

  Response.Write &quot;<TD>&quot; & objResultsRS(&quot;Your_Results&quot;) & &quot;</TD>&quot; & vbcrlf

Wend

Do While intCount < 4
  Response.Write &quot;<TD>&nbsp;</TD>&quot; & vbcrlf
Loop

Response.Write &quot;</TR>&quot; & vbcrlf & &quot;</TABLE>&quot; & vbcrlf
Tony
 
This dups the result of a query into an html table.

<%
dim rs
set rs = server.CreateObject(&quot;adodb.recordset&quot;)
rs.Open &quot;select * from mytable&quot;,&quot;wouldn't you like to know&quot;
with response
.Write &quot;<table>&quot; & vbcrlf
do until rs.EOF
.Write &quot; <tr>&quot; & vbcrlf
for each fld in rs.Fields
.Write &quot; <td>&quot; & vbcrlf
Response.Write fld.value
.Write &quot; </td>&quot; & vbcrlf
next
rs.MoveNext
.Write &quot; </tr>&quot; & vbcrlf
loop
.Write &quot;</table>&quot; & vbcrlf
end with
rs.close
set rs = nothing
%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top