Link to home
Start Free TrialLog in
Avatar of sre22
sre22

asked on

Retrieve URL from database

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.
Avatar of Saqib Khan
Saqib Khan
Flag of United States of America image

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.
Avatar of sre22
sre22

ASKER

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.
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?
Avatar of sre22

ASKER

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?
ASKER CERTIFIED SOLUTION
Avatar of Saqib Khan
Saqib Khan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sre22

ASKER

Thank you so much!!!

I'm sure I'll have some more questions for you soon :)
Always Feels Good to help someone:).
Sure Bring it on.
Avatar of sre22

ASKER

ok.  posting a follow up to this one.