Skip navigation
Currently Being Moderated

Turn a text database search result into a clickable .pdf link to specific images

Feb 11, 2014 2:47 PM

Hello and Good Afternoon all. 


This is baffling me to no end, pretty desperate at this point. 


I have a successfully implemented a search and results page from my database table 'products'.  The results page displays a field from this table as products, msds, datasheet, description.  I would like the msds & datasheet results to be clickable links to files in my images/pdf/msds folder or the images/pdf/datasheet folder. 


The links are specific filenames such as msds-product.pdf or datasheet-product.pdf..  How can I get these links to open the exact filename that comes up in my search result?  I can make it open the entire folder but I want just the specific file. 


I don't write code very well - thank you for any help you can provide.  Cindy

  • Currently Being Moderated
    Feb 11, 2014 3:27 PM   in reply to eminkey

    What scripting language are you using to create your search function?

    It's unclear to me if your search queries are displaying folder or file names.




    Nancy O.

    Mark as:
  • Currently Being Moderated
    Feb 11, 2014 4:23 PM   in reply to eminkey

    Once you have a filename, you would do this in your HTML -


    <a href="images/pdf<?php echo $filename; ?>"><?php echo $filename; ?></a>


    You echo the filename twice - once as part of the href path, and once as the result list element.

    Mark as:
  • Currently Being Moderated
    Feb 11, 2014 5:55 PM   in reply to eminkey

      <td style="font-size: 16px"><a href="images/pdf/msds/<?php echo $row_Recordset_results['msds']; ?>".pdf"><?php echo $row_Recordset_results['msds']; ?></a></td>

    Mark as:
  • Currently Being Moderated
    Feb 12, 2014 3:33 AM   in reply to eminkey

    Good luck, Cindy. There's no need to carry this further.

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points