Hi All!
I wonder, how can I loop trough a record in my database showing the first three matches in a cell structure, then create a new paragraph with the next three matches and so on..?
Thanks.
Frederik
4 1517
I'm not sure how you want the HTML done, but you will need to count to three and every three you reset the timer and start the new line or paragraph. For example, if you were doing it in a table, you would do something like this: - dim x
-
if not objRS.eof
-
response.write "<table><tr>" & vbNewLine
-
-
x = 0
-
do until objRS.eof
-
response.write "<td><p>" & objRS("title") & " - " & objRS("description") & "</td>" & vbNewLine
-
x = x + 1
-
if x = 3 then
-
response.write "</tr><tr>" & vbNewLine
-
x = 0
-
end if
-
objRS.movenext
-
loop
-
response.write "</tr></table>" & vbNewLine
-
end if
There are a couple ways to structure the loop to get this same effect, but this is as good as any. Does this make sense?
Jared
Yeah sure, just needed some quidelines on how to construct the code, Im sure i will make it work from here. Thanks!
Hey again! I'm stuck on a problem with this code. I need to show a table with this code with two or three cells containing more than one info for each items. Quess I need to make a loop wihtin a loop. My code looks like this for now the underlaying cells are marked out. Can't seem to figure this out... - <%
-
dim varSelectedChar
-
dim x
-
if Request.QueryString("l") = "" then
-
varSelectedChar = "a"
-
else
-
varSelectedChar = Request.QueryString("l")
-
end if
-
-
Set Conn = Server.CreateObject("ADODB.Connection")
-
DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; "
-
DSN = DSN & "DBQ=" & Server.MapPath("db1.mdb")
-
Conn.Open DSN
-
-
strSQL = "SELECT * FROM moveez WHERE m_titel LIKE '" & varSelectedChar & "%'"
-
Set rs = Conn.Execute(strSQL)
-
-
if not rs.EOF then
-
response.write "<table border=""0"" cellpadding=""0"" style=""border-collapse: collapse"" width=""100%"">"
-
response.write "<tr>"
-
-
x = 0
-
do until RS.eof
-
'Response.Write "<td width=""5""> </td>"
-
Response.Write "<td width=""100""><a href=""?pid=details&fid=" & rs("ID") & """><img width=""80"" height=""100"" src=""/film/m_pic/" & RS("m_picture") & """></a></td>"
-
-
'Response.Write "<td width=""5""> </td>"
-
'Response.Write "<td>" & rs("m_titel") & "</td>"
-
-
'Response.Write "<td> </td>"
-
'Response.Write "<td> </td>"
-
-
x = x + 1
-
if x = 5 then
-
response.write "</tr>"
-
response.write "<tr>"
-
x = 0
-
end if
-
RS.movenext
-
loop
-
-
response.write "</tr>"
-
response.write "</table>"
-
-
else
-
Response.Write("SOME ERROR (" & varSelectedChar & ")"
-
end if
-
-
Conn.Close
-
Set Conn = Nothing
-
%>
I'm not sure how this isn't working, you didn't say what was going wrong. Anyway, here's one thought. Whenever I need to write a lot of HTML markup including lots of quote marks, I dislike using the two double quotes solution, it seems to go wrong too often for me (and I know what I am doing) and I also see a lot of newbies making mistakes at it. It seems easier for me to declare a variable q = chr(34) and using that all the time for quote marks, or just dropping out of the vbscript temporarily like this: - '...
-
-
if not rs.EOF then %>
-
<table border="0" cellpadding="0" style="border-collapse: collapse" width="100%"><tr>
-
<%
-
x = 0
-
do until RS.eof
-
%>
-
<td width="100"><a href="?pid=details&fid=<%=rs("ID")%>"><img width="80" height="100" src="/film/m_pic/<%=RS("m_picture")%>"></a></td>
-
<%
-
'...
Not sure if that helps or not. Let me know.
Jared
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Rick DeBay |
last post by:
I'm trying to create a layout table, where the spacing between rows varies.
I've tried using setting margin-top and border-top for the rows I wan't spaced
down from the one above, and I've also...
|
by: tony collier |
last post by:
hi
i have various labels on my page with ID's label_1, label_2 , label_3 etc.
How can i write a loop that sequentially changes their text values to
values i have in an array eg;.
for...
|
by: Rvo |
last post by:
I have written an application that manipulates files, while doing so the
program is running in a loop and any actions on the GUI will not get any
response. When I try to stop the processing of the...
|
by: metoikos |
last post by:
I've scoured the web (clumsily, I'm sure) for information on the
difficulties I am having, checked my markup in validators, and had a
friend with more CSS clue look over it, but I haven't had any...
|
by: phil-news-nospam |
last post by:
I have a table with 3 columns in 1 row. I want to increase the spacing
_between_ the columns (gutter) _without_ increasing the spacing between
those columns and the table itself. Is there a way...
|
by: shapper |
last post by:
Hello,
I created a connection to a database and everything is fine. Finally I
wrote this:
connection.Open()
**** MyFunction( , , ) ****
connection.Close()
|
by: Sacred Heart |
last post by:
Hi,
I'm new to Python and have come across a problem I don't know how to
solve, enter com.lang.python :)
I'm writing some small apps to learn the language, and I like it a lot
so far.
My...
|
by: GlenC |
last post by:
Hello everyone,
I'm brand new to this forum and have not yet trolled through all the posts so bear with me please.
I am a beginner at VB.Net programming (using VB express 2008) and (of course)...
|
by: GlenC |
last post by:
Hello everyone,
I'm brand new to this forum and have not yet trolled through all the posts so bear with me please.
I am a beginner at VB.Net programming (using VB express 2008) and (of course)...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |