Can someone point me in the right direction. I'm new at this and I think
maybe I'm trying something too complicated for my skill level. I have to
create a list of books based on the type of book. I have a table with all
books called holdings. That table has a column called listtypeid and books
can have more than one listtype. Listtypeids are sent to a table called
booklists. There are currently 4 listtypes but more are possible.Here is my
problem. I can't generate a list of books from booklists. Can someone tell
me what my approach to this should be? I'm stumped. This what I have.

addholdings.cfm, below is from the add form
..
..
..
<tr>
<td>Book List:</td>
<td>
<!--- Book list --->
<cfselect name="listtypeid" multiple="yes" size="4">
<option value="0"></option>
<cfoutput query="listtypes">
  <option value="#listtypeid#">#listtype#</option>
</cfoutput></cfselect></td>
</tr>
..
..
..

this is from the form action,insertHoldings.cfm

<!--- Insert holdings to holdings table--->
<cfinsert datasource="thedb" tablename="holdings">

<!--- Get the last holdingsid entered --->
<cfquery name="qryGetLastHoldingsID" datasource="thedb">
 SELECT last_insert_id() AS lastHoldingsID;
</cfquery>


<!--- if listtypeID, insert holdingsID and listtypeID in booklists --->

<cfif isDefined("form.listtypeID")>

 <!--- check for multiple listtypeID --->
 <cfif form.listtypeID CONTAINS ",">
  <cfset arlisttypeList = listToArray(#form.listtypeID#, ",")>
  <cfloop from="1" to="#ArrayLen(arlisttypeList)#" index="index">

   <cfquery name="qryInsertListtype" datasource="thedb">
   INSERT INTO booklists (
    holdingsID,
    listtypeID
   )
   VALUES (
    '#qryGetLastHoldingsID.lastHoldingsID#',
    '#arlisttypeList[index]#'
   )
   </cfquery>
   <cfset index = index + 1>
  </cfloop>

 <cfelse>
  <!--- Process if a single listtypeid --->
  <cfquery name="qryInsertListtype" datasource="thedb">
   INSERT INTO booklists (
    holdingsID,
    listtypeID
   )
   VALUES (
    '#qryGetLastHoldingsID.lastHoldingsID#',
    '#listtypeid#'
   )
         </cfquery>
 </cfif>
</cfif>
<!--- end multiple listtypes --->


<!--- Feedback --->
<style type="text/css">
<!--
..style1 {
 color: #0000FF;
 font-weight: bold;
}
-->
</style>

<cfoutput>
"<span class="style1">#FORM.title#</span>" has been added.</cfoutput>



I have these tables.

holdings table
holdingsid
title
author
publisherid
copyright
subjectid
listtypeid

booklists table
holdingsid (one holdingsid can appear here multiple times)
listtypeid

listtypes table
listtypeid
listtype

Thank you.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:316811
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to