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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help on how to do this

Status
Not open for further replies.
Feb 3, 2003
28
US
Working on updating a classified ads web site.
I would like to list the ad in a table, sorted by category. Sounds easy but wait there's more..
list them by columns, 10 items in a column after the 10 item it builds a second column and continues listing the ads until it reaches the end and then starts on the next category, displaying title and then ads. It would look something like this

title
1 11
2 12
3 Title
4 1
5 2
6 3
7 4
8 5
9 6
10 7

get the picture? Similar to a newspaper.
I want to do this for 5 columns and then if there is still more display a next page button.

the ads, categories, etc. are stored in an access db for now. I will convert it to a SQL when it's ready for production. The database will always be changing so one day it may have 50 ads, the next 100, after that 70, etc.
 
Your right. I need to learn more that is why I'm taking this project on.
I can get this table to build right to left without a problem. I don't know how to get this to build up and down. That is where I am stuck.
 
Then read these links several times. The concepts are there and there's no down side (you'll have memorized some very useful s#%@)..I mean stuff. Up and down is just <tr></tr>.
 
actually it's <td></td> [lol]

_____________________________________________________________________
[sub]You can accomplish anything in life, provided that you do not mind who gets credit.
Harry S. Truman[/sub]
onpnt2.gif

 
Ya know...I really thought long and hard about doing:
<tr><td>yourstuff</td></tr>
but didn't think you'd be watching.

Thanks for covering my back. [lol]

Besides...That's why you get the big bucks.
 
I don't mindthe coveringhte back thing, but I'm still waiting for the &quot;big bucks&quot; [sad]

_____________________________________________________________________
[sub]You can accomplish anything in life, provided that you do not mind who gets credit.
Harry S. Truman[/sub]
onpnt2.gif

 
You want zee big bucks, you work with zee Microshaft.

codestorm
Newbie Life Member.
Fire bad. Tree pretty. - Buffy
<insert witticism here>
 
But then I'd have to forget about the <td></td> tags completely AND there would be nobody like onpnt to cover my ass.
 
Try using a table, inside a table.

<table>
<tr>
<td>
<table>
<%
iCount = 0
while not rs.eof
iCount = iCount + 1
if iCount > 10 then
'10 items printed, start new column
response.write(&quot;</table></td><td><table>&quot;)
response.write(&quot;<tr><td>&quot; & rs(&quot;MyField&quot;) & &quot;</td></tr>&quot;) 'write out data
iCount = 1
else
response.write(&quot;<tr><td>&quot; & rs(&quot;MyField&quot;) & &quot;</td></tr>&quot;) 'write out data
end if
rs.movenext
wend
%>
</table>
</td>
</tr>
</table>



Inside a <td> element, you are build another table. You can add multiple items just like any other table and they will stay in column one.
After 10 items are put in a column, it's closed an a new one is started. So if you had 30 items, you would end up with 3 columns.

Sorting them by category can be done during the SQL SELECT statement by using the ORDER BY command at the end of the SELECT. For instance:

SELECT * FROM CLASSIFIEDS ORDER BY CATEGORY

The * will get all of the fields in the CLASSIFIED table and the records will be order by the field CATEGORY.


Bernie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top