Author |
Topic |
|
Mr_Anderson
Starting Member
United Kingdom
20 Posts |
Posted - 14 April 2001 : 10:46:57
|
I'm getting a little confused and would like some general help or pointer in the right direction.
I'd like to take links from a Database and place them automatically into a webpage. The page here shows what I'd like to do, but obviously my asp pages wont be hosted at crosswinds. I'd like to generate the cells for the links on the left and the text and url's for them so that the links can be generated automatically on each page and altered by changing the databse, but I dont know how to go about doing this. I've searched around for tutorials and read some but I dont really understand them, so far I realise i need to use a DSN less connection to the database, and I know sql has something to do with this but ive no idea what sql is.
BTW, I'm testing the asp pages out on my machine (win2k pro, IIS 5, FrontPage XP, Access XP, PWS) before I upload them to my webspace.
Please, any help, advice you could offer me would be much appreciated. I hope my questions aren't too confusing.
Thanks
|
|
Doug G
Support Moderator
USA
6493 Posts |
Posted - 14 April 2001 : 12:55:26
|
There are tutorials at www.4guysfromrolla.com, www.learnasp.com and many more web sites.
In general, you'll probably want two fields in a database, one for the text to display and one for the link. Your asp page will establish a connection to your database (using DSN or DSNLess connections) and your code will use a sql query like 'select linktext, urltext from table' (the names are made up)
You'll execute the sql query against your database using the connection you setup, and get the results back to a recordset, like 'set rs1 = conn.execute(sqltext)' (again made up names this isn't cut & paste code)
Next you will loop through all the returned data in your recordset and write the links, like
... Do while not rs1.EOF response.write "<a href=" & rs1("linkurl") & rs1("linktext") & "</a></br>" rs1.movenext Loop ... ...
Then you will probably want an admin page that will let you change the information in your database using a form.
====== Doug G ====== |
|
|
Mr_Anderson
Starting Member
United Kingdom
20 Posts |
Posted - 14 April 2001 : 14:05:36
|
yes that sounds familiar, it all makes sense now
Thanks doug for the quick response, much appreciated. Now I know what I must do
|
|
|
Mr_Anderson
Starting Member
United Kingdom
20 Posts |
Posted - 18 April 2001 : 14:43:07
|
Ok I'm getting better at this now, managed to read from a database, loop round and write the text and a href's for the links to the page.
But, now I want to use different text and links for each page. Not entirely different, some links will be the same throughout each page and other links will be different dependent on the page.
My question is how should I go about this? Should I just create a new table for each page in my database, or make an sql query on my database, perhaps I'll have to do a multiple query? but I dont know how to do this, some simple code would help me understand what I need to do.
And one other thing, what is the "&" character in response.write? I think its called an ampersand but what is its exact purpose?
I hope you can help, thanks.
______________________
www.multiplayercentral.co.uk
Edited by - Mr_Anderson on 18 April 2001 14:52:30 |
|
|
|
Topic |
|
|
|