MySQL Forums
Forum List  »  Newbie

Create URL from to database fields in query results
Posted by: Eric Howell
Date: April 29, 2005 02:24PM

Hello -

I have a MySQL database with table that works as document library. Table keeps details about docs on our server. There are bunch of fields but the key ones here are FileName, URL and location. I'm using PHP to work with the MySQL Database hosted on a Mac OS X Server.

Basically, I have a query set up to pull certain records based on a field called Keywords. On the result page I want a field (or item) that combines the URL field and Filename field that ultimately points to the phycial location of the file. For every record thr url field contents is the same since the physical location of the files are in the same directory on the server. Right now the URL field has http://www.mysite.com/docs/.

I'd like the result page to have the filename shown, but that filename would be a link to URL+filename.

Is there a way to do this?

This is my current Query:

<?php
$colname_Recordset1 = "1";
if (isset($_POST['Keywords'])) {
$colname_Recordset1 = (get_magic_quotes_gpc()) ? $_POST['Keywords'] : addslashes($_POST['Keywords']);
}
mysql_select_db($database_MasterMySQL, $MasterMySQL);
$query_Recordset1 = sprintf("SELECT DocID, Title, Filename, Subject, Keywords, Category, `Size`, DateSaved, Location, Author, Summary, Icon, url FROM doclibrary WHERE Keywords LIKE '%%%s%%'", $colname_Recordset1);
$Recordset1 = mysql_query($query_Recordset1, $MasterMySQL) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>

Thanks

Options: ReplyQuote


Subject
Written By
Posted
Create URL from to database fields in query results
April 29, 2005 02:24PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.