Re: download link to file
[EMAIL PROTECTED] wrote: > I have a pdfs/documents saved in a field called 'content' on my db and I > want to create an active hyperlink so users can download. any ideas how I > can achive this. > > I am sure it is simple but cannot find an easy example posted. > > thanks, > > Ross Hi Ross, Answered you in the PHP group, but this is a different query. Here is the PHP and MySQL I use to do the same thing. I see no reason not to use HTML to create links to download your pdf files by the way. It keeps things simple. You do mean that you keep the filenames in the database, right? Feel free to email if you want some explanation, as it seems we are doing the same thing. /* *Construct MySQL query */ $query = array_pop($queries); $select = "SELECT files.*"; $from = "\nFROM files, assoc, words"; $where = "\nWHERE words.word = '" . $query . "' AND "; $where .= "words.id = assoc.word_id \nAND"; $where .= " assoc.file_id = files.id "; foreach ($queries as $q) { $from .= ",\nassoc AS assoc_$q, "; $from .= " words AS words_$q"; $where .= "\n AND words_$q.word = '" . $q . "'"; $where .= "\nAND \nwords_$q.id = assoc_$q.word_id \nAND "; $where .= "assoc_$q.file_id = files.id "; } if ((isset($startdate) and isset($enddate)) or ($startdate != "" and $enddate != "")) { $where .= " \nAND \nfiles.startdate <= '$enddate' \nAND "; $where .= "files.enddate >= '$startdate'"; } $order = "\n ORDER BY files.series, files.volume"; /* * connect to database */ $conn = mysql_connect($dbhost, $dbuser, $dbpass); if (!$conn) { die("couldn't connect to $dbhost"); } if (!mysql_select_db($dbname, $conn)) { die(mysql_error($conn)); } /* construct query */ $selectq = $select . $from . $where . $order; echo " \n"; $res = mysql_query($selectq, $conn); if (!$res) { die(mysql_error($conn)); } /* * Output the results to browser */ /* * Create HTML table for results */ echo ""; echo "SourceVolumeStart dateEnd date\n"; while ($line = mysql_fetch_array($res, MYSQL_ASSOC)) { echo "$line[series]$line[volume]$line[startdate]$line[enddate]\n"; } mysql_close($conn); echo ""; -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: download link to file
--- [EMAIL PROTECTED] wrote: > I have a pdfs/documents saved in a field called 'content' on my db > and I want to create an active hyperlink so users can download. any > ideas how I can achive this. > > I am sure it is simple but cannot find an easy example posted. > > thanks, > > Ross Hyperlinks are part of the Hypertext Markup Language (better known as HTML). HTML messages (better known as web pages) are managed by HTTP (Hypertext Transfer Protocol) servers. A tool (like a web browser) sends requests for HTML messages (web pages) by using HTTP to request them from various kinds daemons (web servers) (pronouced: DAY-mons not DEE-mons). There are several very popular daemons out there, the most often encountered are Apache (apache.org), and IIS (microsoft.com). Their responses are generated either by: a) sending a message explaining why the response failed (an error code) b) sending the file that was orginally requested, as is. c) processing some kind of script that generates a message in HTML (or any of several other standard information formats) that was requested of the daemon. With option C, there are a wide range of scripting languages that are used to generate/process the requested content: PHP, Perl, Python, Java, Javascript, VBscript, etc. What your question sounds like is a request to be shown how to write some server-side script (at the web server) to convert some data you have in your database into a message (file) that can be sent in response to a web browser's request for information (which can be initiated by the user clicking on a link). And you wanted to know how to format that link so that it becomes clickable. Am I close? Shawn Green Database Administrator __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
download link to file
I have a pdfs/documents saved in a field called 'content' on my db and I want to create an active hyperlink so users can download. any ideas how I can achive this. I am sure it is simple but cannot find an easy example posted. thanks, Ross