SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2000
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Query Questions (CFM)

    I am having a little trouble wih my cold fusion site. I wonder if I can have the following:

    http://yourdomain.com/list.cfm?type=whatever
    http://yourdomain.com/list.cfm?state=whatever
    http://yourdomain.com/list.cfm?country=whatever

    or do I have to have a separate file for each:

    http://yourdomain.com/type.cfm?type=whatever
    http://yourdomain.com/state.cfm?state=whatever
    http://yourdomain.com/country.cfm?country=whatever

    ---------

    I know how to do the second, but not the first. When I try to put them together I just get errors. I'd appriciate any help!

  2. #2
    I'm a college yuppie now! sbdi's Avatar
    Join Date
    Jul 2000
    Location
    Dublin , Ireland
    Posts
    1,271
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <cfoutput query="display_articles"><tr bgcolor="white"><td><a href="article.cfm?call_article=#id#">#heading#</a></cfoutput>
    that would be the main page where people can clikc on a list of everything in your database

    Code:
    <cfoutput query="get_news"> 
                
                    #Heading#
                  #Article# 
    #author# </cfoutput>
    That would be to display it.

    Replace anything in between # # with the name of your table columns
    Back Again

  3. #3
    SitePoint Wizard westmich's Avatar
    Join Date
    Mar 2000
    Location
    Muskegon, MI
    Posts
    2,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, you can attach different querystring name/value pairs to any file individual or at once.

    mypage.cfm?type=whatever&state=whatever&country=whatever
    Westmich
    Smart Web Solutions for Smart Clients
    http://www.mindscapecreative.com

  4. #4
    SitePoint Enthusiast
    Join Date
    Jul 2000
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ummm...sdbi.....You just confused me more. Westmich, I understand what your saying but what code do I put on to my page to get that to work?

  5. #5
    SitePoint Wizard westmich's Avatar
    Join Date
    Mar 2000
    Location
    Muskegon, MI
    Posts
    2,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The purpose of querystrings is to pass data to server-side code.

    For example I have an HTML template for one of my sites. Several sections are built with dynamic CF include tags. This gives the illousion of an unlimited number of pages, while I'm actually maintaining only one.
    Code:
    - Links somewhere on my page (index.cfm) -
    <a href="index.cfm?pageID=Home">Home</a>
    <a href="index.cfm?pageID=AboutUs">About Us</a>
    etc...
    
    - dynamic content processed by CF -
    <!--- Navigation Bar --->
    <cfinclude template="nav_includes/#url.pageID#.cfm">
    
    <!--- Main Content --->
    <cfinclude template="contents/#url.pageID#.cfm">
    
    and so on...
    The other great thing with CF (and other server-side languages) is that thier includes are processed linearly, i.e. they can be placed within IF, CASE, or other conditional logic statements.
    Westmich
    Smart Web Solutions for Smart Clients
    http://www.mindscapecreative.com

  6. #6
    I'm a college yuppie now! sbdi's Avatar
    Join Date
    Jul 2000
    Location
    Dublin , Ireland
    Posts
    1,271
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry thats the actual code I was using for my site I just happened to be updating it while I was reading your post so thought it might help. What that code basically did was create dynamic links from the database and link them by there ID column in the db.

    The second sniplet was to display it.

    Ok Westmich beat me to the post by a minute I'm gonna get ya for that
    Back Again

  7. #7
    SitePoint Enthusiast
    Join Date
    Jul 2000
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Perphaps I should ask a different question. When I go to a url like http://www.mywebsite.com/index.cfm?Year=2000 it doesn't just display the 2000 ones, it displays them all. I basiclly wonder what I need to put into the index.cfm file for it to work.


    You might of already told me this and I'm just not relizing it.

  8. #8
    SitePoint Wizard westmich's Avatar
    Join Date
    Mar 2000
    Location
    Muskegon, MI
    Posts
    2,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Since the code is server-side, there is no telling what they're doing with it. Like I was saying, querystrings allow you to pass info from one page to another. It's completely up to you the developer on what you want to do with it.

    Another good example is search engines. When you type something in the search box, you are taken to a search results page that has taken your querystring, sumbited it to a database, and returned the results. And because it is in the querystring, you can bookmark and return later see the results again which will reflect any changes in the database since your previous visit.
    Westmich
    Smart Web Solutions for Smart Clients
    http://www.mindscapecreative.com

  9. #9
    I'm a college yuppie now! sbdi's Avatar
    Join Date
    Jul 2000
    Location
    Dublin , Ireland
    Posts
    1,271
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is the SQL statment do order by 2000 ? Maybe if you could post some of the code or something.
    Back Again

  10. #10
    SitePoint Enthusiast
    Join Date
    Jul 2000
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is the code for the year page:

    Code:
    <CFQUERY
     DATASOURCE="rco"
     NAME="listing">
    SELECT Coaster,
                 Park,
                 Type,
                 State,
                 Country,
                 Year,
                 Game,
                 Designer,
                 Builder
          FROM Coasters_Listing
          WHERE Year = #Year#
    </CFQUERY>


    This particular page works fine.

    I put list.cfm?year=0000

    Which ever year I put in it just shows them.

    I'd really like to know what I need to change in the code for something like: list.cfm?year=1996&Country=England to work.

  11. #11
    SitePoint Wizard westmich's Avatar
    Join Date
    Mar 2000
    Location
    Muskegon, MI
    Posts
    2,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Where Year = #url.year#

    Howver, I had some issues posting dates to MS Access with CF vaiables. I ended up doing this-

    Where Year = ###url.year###
    Westmich
    Smart Web Solutions for Smart Clients
    http://www.mindscapecreative.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •