Hi,
Thanks guys! I have given all replies a try but managed to get it
done this way better... but it's only outputting 1 articleTitle and
not the whole lot. Sorry that i didn't state my problem - it was
really because i couldn't work out what i was doing and didn't
realise the possibility of having a <cfoutput> within a <cfoutput> so
was just in total confusion.
I'm re-doing all of my site (this hasn't been released yet): http://
www.020.com/index_020homepage2.cfm?cp=11 and then click on the
CONTACT US link in the text.
In my new site it's all divs instead of tables so it just seems very
new having all of my queries being done all at once even though most
people may not even look at this section.
My code now stands at:
<cfquery name="GetAuthors" datasource="user020">
SELECT tbl_020authorDetails.authorID,
authorPhotograph, authorFirstName, authorSurname, authorAboutMe,
tbl_020articleDetails.articleID, tbl_020articleDetails.authorID,
articleTitle
FROM tbl_020authorDetails, tbl_020articleDetails
WHERE authorPhotograph <> ' ' AND
tbl_020articleDetails.authorID = tbl_020authorDetails.authorID
</cfquery>
<div id="contributorarea">
<cfoutput query="GetAuthors" group="authorID">
<div class="contributorminibox"
onclick="javascript:clickarticle(this)">
<div class="contributorphotograph">
<img
src="#PhotosWritersWeb##GetAuthors.authorPhotograph#">
</div>
<div class="contributortext">
#authorFirstName# #authorSurname#
<p><cfif authorAboutMe eq ''>I was born
in the outer reaches of the galaxy and ever since first seeing my
first book had a desire to write one.<cfelse>#ParagraphFormat
(authorAboutMe)#</cfif></p>
</div>
<div class="contributorurls">
<cfoutput>#articleTitle#<br /></cfoutput>
</div>
</div>
</cfoutput>
</div>
On 27 Sep 2005, at 16:13, Deanna Schneider wrote:
> You don't explain what your "problems" are. If there are multiple
> articles
> per author, then you _should_ get multiple rows back per author.
> What you
> probably want to do is order that joined query by the author's
> name, and
> then do your output like so:
>
> <cfoutput query="GetAuthors" group="authorid">
> <div class="contributorminibox"
> onclick="javascript:clickartic
>
>>
>> le(this)">
>> <div class="contributorphotograph">
>> <img
>> src="#PhotosWritersWeb##GetAuthors.authorPhotograph#">
>> </div>
>> <div class="contributortext">
>> #authorFirstName# #authorSurname#
>> <p>#ParagraphFormat(authorAboutMe)#</p>
>> </div>
>> <div class="contributorurls">
>> <cfoutput>The titles to go here.</cfoutput> <!--- This will loop
>> through
>> all articles by the current author --->
>> </div>
>> </div>
>> </cfoutput>
>>
>
>
>
> On 9/27/05, Saturday (Stuart Kidd) <[EMAIL PROTECTED]> wrote:
>
>>
>> Hi,
>>
>> I'm trying to retrieve data from two tables in one query, when i was
>> just querying one everything was okay:
>>
>> <cfquery name="GetAuthors" datasource="user020">
>> SELECT authorID, authorPhotograph, authorFirstName,
>> authorSurname, authorAboutMe
>> FROM tbl_020authorDetails
>> WHERE authorPhotograph <> ''
>> </cfquery>
>>
>> But my two table query (join) had a problem:
>>
>> <cfquery name="GetAuthors" datasource="user020">
>> SELECT tbl_020authorDetails.authorID,
>> authorPhotograph, authorFirstName, authorSurname, authorAboutMe,
>> tbl_020articleDetails.articleID, tbl_020articleDetails.authorID,
>> articleTitle
>> FROM tbl_020authorDetails, tbl_020articleDetails
>> WHERE authorPhotograph <> ' ' AND
>> tbl_020articleDetails.authorID = tbl_020authorDetails.authorID
>> </cfquery>
>>
>> The thing is that I am trying to pull all the authors and their
>> articles - but some authors have more than one article, is this the
>> best way to do it?
>>
>> I'm also worried that if i pull the data like in the join above (if
>> that even works properly) how do i break it down, ie how do i
>> differentiate between getting information for individual authors?
>>
>> <cfoutput query="GetAuthors">
>> <div class="contributorminibox"
>> onclick="javascript:clickarticle(this)">
>> <div class="contributorphotograph">
>> <img
>> src="#PhotosWritersWeb##GetAuthors.authorPhotograph#">
>> </div>
>> <div class="contributortext">
>> #authorFirstName# #authorSurname#
>> <p>#ParagraphFormat(authorAboutMe)#</p>
>> </div>
>> <div class="contributorurls">
>> The titles to go here.
>> </div>
>> </div>
>> </cfoutput>
>>
>>
>> Thanks for any help. Should I just keep this in two queries?
>>
>> Saturday
>>
>>
>>
>>
>>
>>
>>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:219347
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54