Solved

Retrieve URL from database

Posted on 2003-10-30
8
158 Views
Last Modified: 2012-05-04
I have a simple website that has some dynamic pages.  The pages load the names of forms and other documents that are stored in an Access database.  I also have in the database location of each form or document on the network.  What I am trying to do is hyperlink to the location specified in the database.


Example:

My Forms.asp page loads the names of each form stored in the database when opened.  When the user clicks on one of these form names, I want to open that form using the path that is also stored in the database.  How would I do that?  I am using Dreamweaver MX with ASP and MS Access.

If this is not clear, let me know and I will try to clarify.

Thanks.
0
Comment
Question by:sre22
  • 4
  • 4
8 Comments
 
LVL 23

Expert Comment

by:Saqib Khan
ID: 9655247
You have something Like page1.asp Stored in Database?

if thats the Case then simplly Follow the Given Example.

<a href="<%=rs("field_url")%>"><%=rs("field_url")%></a>

if I am not Clear or you are confused let me know so i can Assist you in a better way.
0
 

Author Comment

by:sre22
ID: 9655467
Here is what I have:

An access database with a table called "Files".  The table has these fields:

FileName  (Example: "Employee Computer Manual")
FileDescription (Example: "Computer Manual explaining how to use various software programs and applications")
FileLocation (Example: "I:\Manuals\Computer Manual.doc")

In my website (which is actually an Intranet) i have a page called Forms.asp that dynamically displays all the FileNames and FileDescriptions that are in my Access database.  That part works fine.  It lists each FileName and description as I wanted.  But my problem is that I want to be able to link to the actual file (Word doc, Excel, etc...) so that when the user clicks on a FileName that is displayed on Forms.asp, it will open the file by using the field in the database "FileLocation".

Maybe there is an easier way to do this so I'm open to suggestions, but this was the best way I could think of.  Hopefully this clears things up.
0
 
LVL 23

Expert Comment

by:Saqib Khan
ID: 9655527
You Doing Good.

Where you printing File Names Do this
imagine these fields equall to your Fields in Database.

file_name = rs("file_name")
file_loc = rs("file_loc")

imagine this this in the LOOP That Prints all the File Names on your Page

<%=file_name%>

so to Link it to the Location

<a href="<%=file_loc%>">    <%=file_name%>  </a>

Did That Make Sense?
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:sre22
ID: 9655559
ok.  I think I understand.  I am just learning Dreamweaver but still don't know very much html.  I created the dynamic data using a record set and I believe this is the code where it loads the data from the database:

While ((Repeat1__numRows <> 0) AND (NOT MGInfoForms.EOF))
%>
    <tr>
      <td width="302"><%=(MGInfoForms.Fields.Item("FileName").Value)%></td>  
      <td width="575"><%=(MGInfoForms.Fields.Item("FileDescription").Value)%></td>
    </tr>
    <%
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  MGInfoForms.MoveNext()
Wend

so using this, where would I put in your code?
0
 
LVL 23

Accepted Solution

by:
Saqib Khan earned 100 total points
ID: 9655568
> <td width="302"><%=(MGInfoForms.Fields.Item("FileName").Value)%></td>  

do this

 <td width="302"><a href="<%=MGInfoForms.Fields.Item("FileLocation").Value%>"><%=(MGInfoForms.Fields.Item("FileName").Value)%></a></td>  
0
 

Author Comment

by:sre22
ID: 9655605
Thank you so much!!!

I'm sure I'll have some more questions for you soon :)
0
 
LVL 23

Expert Comment

by:Saqib Khan
ID: 9655608
Always Feels Good to help someone:).
Sure Bring it on.
0
 

Author Comment

by:sre22
ID: 9655618
ok.  posting a follow up to this one.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For those who don't know, Adobe Dreamweaver is a popular commercial web editor that enables you to design, build and manage complex websites. The editor is a WYSIWYG (What You See Is What You Get) web editor, which means that you can create your web…
This article is very specific and is only intended to help if you are installing Dreamweaver 8 in a Windows 7 environment with Office 2007 installed.   I'm not sure why Microsoft tends to release OS' that should not be released but they do.  Windows…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question