esap
07-06-2004, 06:47 PM
I am confused if I should be here, or in the mySQL forum, since it is a combination of the two (ASP and mySQL).
I have a very simple page that pulls the records from a mySQL database. The results are shown in a 2 coulmn table that goes left to right alphabetically. Problem is my employer wants the results to be 2 column, but descending alphabetically. I know I have to divide the records, but otherwise I havent a clue on how to display the results this way!
This is the code in use now:
<%
set oRS = getRS("SELECT * FROM charities WHERE active=1 order by charity_name")
iCount = 0
WHILE NOT oRS.EOF
If iCount = 0 Then Response.Write "<tr><td width='54'><img src='images/cdot.gif' width='54' height='1' alt='' border='0'></td>" End If
iCount = iCount + 1%>
<% IF oRS("charity_url") = "" then
%>
<td bgcolor="#FFFFCC" width="50%"><%=oRS("charity_name")%></td>
<%ELSE%>
<td bgcolor="#FFFFCC" width="50%"><a href="<%=oRS("charity_url")%>" target="_blank"><%=oRS("charity_name")%></a></td>
<%END IF%>
<%
If iCount = 2 Then Response.Write "<td width='54'><img src='images/cdot.gif' width='54' height='1' alt='' border='0'></td></tr>" END IF
oRS.MoveNext
IF iCount = 2 then iCount = 0
WEND
oRS.Close
%>
<%
'If NOT oRS.EOF then
' get_product = oRS("primary_key")
'Else
' get_product = "PRODUCT NOT FOUND"
'End If
set oRS = nothing
%>
This is an asp page and a mySQL database!
Any advice would be greatly appreciated!
I have a very simple page that pulls the records from a mySQL database. The results are shown in a 2 coulmn table that goes left to right alphabetically. Problem is my employer wants the results to be 2 column, but descending alphabetically. I know I have to divide the records, but otherwise I havent a clue on how to display the results this way!
This is the code in use now:
<%
set oRS = getRS("SELECT * FROM charities WHERE active=1 order by charity_name")
iCount = 0
WHILE NOT oRS.EOF
If iCount = 0 Then Response.Write "<tr><td width='54'><img src='images/cdot.gif' width='54' height='1' alt='' border='0'></td>" End If
iCount = iCount + 1%>
<% IF oRS("charity_url") = "" then
%>
<td bgcolor="#FFFFCC" width="50%"><%=oRS("charity_name")%></td>
<%ELSE%>
<td bgcolor="#FFFFCC" width="50%"><a href="<%=oRS("charity_url")%>" target="_blank"><%=oRS("charity_name")%></a></td>
<%END IF%>
<%
If iCount = 2 Then Response.Write "<td width='54'><img src='images/cdot.gif' width='54' height='1' alt='' border='0'></td></tr>" END IF
oRS.MoveNext
IF iCount = 2 then iCount = 0
WEND
oRS.Close
%>
<%
'If NOT oRS.EOF then
' get_product = oRS("primary_key")
'Else
' get_product = "PRODUCT NOT FOUND"
'End If
set oRS = nothing
%>
This is an asp page and a mySQL database!
Any advice would be greatly appreciated!