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

ADDING .PDF TO MY CFOUTPUT FROM QUERY 1

Status
Not open for further replies.

kingjjx

Programmer
Joined
Sep 18, 2001
Messages
181
Location
US
Hi, I am outputing a query from a database. I am linking the CFOUTPUT to a file in a folder. The problem here is the files in the folder ends in .PDF however the names in the database only has the name without the .PDF at the end.

I tried doing <cfoutput>
however that doesnt seem to work. Any advice on how to give the cfoutput a .PDF ending ??

hope i explained this ok.
THANKS
 
what is the code outputting ?

what is the code that you are using ?

does the pdf exist in the directory that you are looking in?
 
the code looks something like this:
<cfoutput>
<a href=&quot;
All the pdf files are in the folder called pdf.
now, file1 is taken from a database table column called files. however it will just return the file name (#file1# returns the name file1 ). My question is, is there anyway I can add a .PDF extension at the end ?
I tried doing #file1#.pdf .. however that doesnt seem to work. is there a function i can use or something ?

thanks
-jon
 
Hi, basically to explain it in simpler terms, how can i add the .PDF extension to all my query returns ?
EXAMPLE.
QUERY PAGE:
<cfoutput>#names#</cfoutput>
****
RESULT:
john nancy ben

I am querying from a database and its returning John, nancy .. how can i add a .pdf at the end of john, nancy ? the reason i want to do this is bcoz i want to link them to pdf files i stored in a folder.
 
Hey A440guy, i saw the typo on my code. I tried doing what you mentioned above but I guess the person who created the database set the field to have a max of 20 characters (im not sure if this is the reason) so doing this ..
<a href=&quot;SHOWS:
.PDF

** there's a huge space between file1 and .PDF and when you click on it .. it shows a bunch of %20%20%20 between file1 and .PDF .. in fact it shows this :

ANYTHING I CAN DO ?
 
Oops! I had the same typo that you had. My bad. The problem is the semi-colons. Delete them. Semi-colons are not valid attribute names! &quot;What?&quot;, you say. Attribute names?

Yes. Your <a> tag has TWO attributes, &quot;href&quot; and &quot;;;&quot;. If you parse the tag, you see:

<a
href=&quot;;;
>
 
I see what you mean about the spaces. Are the spaces in the database? It's a pain, but you could use the RTrim function to remove the trailing spaces. Calista :-X
Jedi Knight,
Champion of the Force
 
Hey guys, i was just wondering... if you guys can please go check out the test site ..

how come when you click on the stockcode, it shifts the rest of the rows down and click it again and it will finally bring you to the linked page. how come its not linking ti right away ?

any ideas ?
 
Works for me. Calista :-X
Jedi Knight,
Champion of the Force
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top