rawky1976 Posted January 26, 2007 Share Posted January 26, 2007 HelloI posted this in another forum on this site earlier today but got no replies. I hope this is a better place to post!!!I'm building a doument management site. Supposing I have a MySQL table with fields for document name and document description. An upload page copies the file via an upload script and file form control to a folder on the webserver (IIS).An SQL Insert command enters into the table above whatever name and description the user has given. Next a search results page displays information from the table in a dynamic repeating table. In this table I want the doument name entry to be a link to the document itself.Currently the user must enter the actual document name, including its file extension or the link will not function properly.Is there a better way to go about all this? Maybe use the file upload form control, can you extract properties of the document. So the name the user enters doesn't have to be the actual file name but the link will still work?Thanks, Mark Link to comment https://forums.phpfreaks.com/topic/35891-database-setup-for-eventual-page-linking/ Share on other sites More sharing options...
rawky1976 Posted January 26, 2007 Author Share Posted January 26, 2007 So far I've not learnt much php but have been using dreamweaver to do the coding for me. You guys have been really helpful.I guess I'll need to learn some more about the coding if I want to use properties of the uploaded document?Mark Link to comment https://forums.phpfreaks.com/topic/35891-database-setup-for-eventual-page-linking/#findComment-170191 Share on other sites More sharing options...
trq Posted January 27, 2007 Share Posted January 27, 2007 You'll need at least three fields in your database. Name, Description and Path. The Path will hold the actual path to the file. Then you could simply run a query something like.....[code]<?php // connect to db. $sql = "SELECT fname,fdesc,fpath FROM files;"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { while ($row = mysql_fetch_assoc($result)) { echo "<a href='{$row['fpath']}'>{$row['fname']}</a>. {$row['fdesc']}<br />"; } } }?>[/code] Link to comment https://forums.phpfreaks.com/topic/35891-database-setup-for-eventual-page-linking/#findComment-170232 Share on other sites More sharing options...
rawky1976 Posted January 31, 2007 Author Share Posted January 31, 2007 So how do I create the entry that will popultate the path field in the db? It will be something like: -http://localhost/<site folder>/ What goes here? Is it the fileupload controls contents?If you use the filename field that will just enter what the user calls the file in the form. As it's going to be a link then I need the actual filename including extension dont I? Link to comment https://forums.phpfreaks.com/topic/35891-database-setup-for-eventual-page-linking/#findComment-173612 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.