Hey guys. You are probably sick to death of this type of tutorial, but I have found a method that is better than all of them! It creates a multidimensional array and fills in a select box depending on the other select boxes value. I must mention Megan in here for whom I used some aspects of her tutorial: http://tutorial95.easycfm.com/
The benefits of this method is it builds an array from the database and inputs that into the select form. So no need for using switch.
<cfquery name="getLocal" datasource="#request.dsn#">
SELECT sub.catID,sub.catName,topc.catID AS topID,topc.catName AS topName
FROM subCat sub INNER JOIN topCat topc ON sub.parentID = topc.catID
ORDER BY topName asc,sub.catName asc
</cfquery>
So here we join 2 tables. The sub category table and the top level category. If you use 1 table like that Recursion Tutorial sugests, you can simply join the table onto itself.
Hopefully that worked for you. Contact me if you have any problems at louisstow AT hotmail DOT com (antispam method. im not crazy)
Great Job!
Great Job Louis! - I really like this :D - Megan
Posted by: Megan
Posted on: 01/16/2008 09:51 PM
|
WTG!
you do great work! this is very cool, and useful!
Posted by: Greg
Posted on: 01/17/2008 06:21 AM
|
Looks good...but
Looks good Louis. One problem I'm having is that I'm not using MSSQL, I'm using MySQL and this part confuses me......
subCat sub INNER JOIN topCat topc
There are 2 tables, right? One named "Sub" and one named "topc"....so where does "subCat and "topCat" come from?
These are subqueries I know, but I still don't know where subCat and topCat come from.
Thanks!
Posted by: Charles
Posted on: 01/26/2008 03:34 PM
|
Tables please :-)
Louis, In Megen's example, she showed the tables and if you would add that to your example it would be VERY helpful, especially to SQL newbies like myself :-)
Thanks!
Posted by: Charles
Posted on: 01/26/2008 04:00 PM
|
Fantastic!!
Works like a charm! VERY handy.
Posted by: Charles
Posted on: 01/26/2008 10:41 PM
|
Table
I didn't include an example of the tables for the following reasons:
a) This is pretty much an alternative to using switch in megans tutorial b) Your database will be different and you shouldn't design your database around my example. You need to adapt your own database.
Thanks Louis
Posted by: Louis Stowasser
Posted on: 02/01/2008 02:05 AM
|
Link to example is broken
Not Found
The requested URL /cfml/louis/multid.cfm was not found on this server.
Posted by: Nate
Posted on: 02/12/2008 04:28 AM
|
Great Job
This was a very very useful tutorial. It solved a lot of my problems. Thank you so much
Posted by: Donboe
Posted on: 04/25/2008 03:28 AM
|