Advertisement

05.17.2008 at 12:24PM PDT, ID: 23411028
[x]
Attachment Details

SELECT - group all files and their filenames/links by titles (with no duplicate titles)

Asked by freshwaterwest in PHP and Databases, Databases Miscellaneous, MySQL

Tags: PHP MYSQL, Firefox 2, Explorer 7, Safari

angelll gave me a great pointer to use GROUP_CONCAT to allow filenames to be grouped under their titles.

this was the result:
................................
title1

file_text1
file_text2

filename1.pdf,filename2.pdf

title2

file_text-a
file_text-b

filename-a.pdf,filename-b.pdf
........................


I need to add the 'filename's as links on each of the 'file_text's but currently I'm getting the following when I add the links in html:

<body>
<p>title1</p>
<p><a href="uploads/filename1.pdf,filename2.pdf">file1<br />file2</a></p>
<p>filename1.pdf,filename2.pdf</p>
<p>title2</p>
<p><a href="uploads/filename3.pdf,filename4.pdf">file-a<br />file-b</a></p>
<p>filename3.pdf,filename4.pdf</p>
<p>title3</p>
<p><a href="uploads/filename5.pdf">file-1a</a></p>
<p>filename5.pdf</p>
<p>title4</p>
<p><a href="uploads/filename6.pdf">file-aa</a></p>
<p>filename6.pdf</p>
<p>title9</p>
<p><a href="uploads/filename7.pdf">file-aaa</a></p>
<p>filename7.pdf</p>
</body>


and the query for above:

$query_Recordset1 = "SELECT title, download_titles.title_id, download_files.title_id, GROUP_CONCAT(DISTINCT file_text SEPARATOR '<br />') file_text, GROUP_CONCAT(DISTINCT file) file FROM download_titles JOIN download_files ON download_titles.title_id = download_files.title_id GROUP BY download_titles.title_id, title ORDER BY download_titles.title";

thanks

Start Free Trial
[+][-]05.17.2008 at 12:54PM PDT, ID: 21590568

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.17.2008 at 01:50PM PDT, ID: 21590712

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.17.2008 at 01:53PM PDT, ID: 21590717

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.17.2008 at 02:05PM PDT, ID: 21590747

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.17.2008 at 02:11PM PDT, ID: 21590763

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.17.2008 at 02:31PM PDT, ID: 21590814

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.17.2008 at 02:33PM PDT, ID: 21590823

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: PHP and Databases, Databases Miscellaneous, MySQL
Tags: PHP MYSQL, Firefox 2, Explorer 7, Safari
Sign Up Now!
Solution Provided By: angelIII
Participating Experts: 1
Solution Grade: A
 
 
[+][-]05.17.2008 at 02:36PM PDT, ID: 21590831

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_Related_20080208