anybody know cold fusion? 
Author Message
 anybody know cold fusion?

anybody know cold fusion?
have some questions.
don't quite understand what happens when you perform a query that will
return multiple rusults.  does it create some sort of array?
for instance, if you perform a cfquery like this:
        <cfquery datasource="database" name="getdata">
                select data
                from table
                where field = "somethingerother"
        </cfquery>
and there are several records where field = "somethingerother", what gets
put in the #getdata.data# variable and how do you retrieve it record at a
time?

--
"eat of me for i am stake"

www.cias.net/texorcist
i bought vio vpc i.glasses!;  now what?



Fri, 05 Nov 1999 03:00:00 GMT
 anybody know cold fusion?

Hi,

Use a <cfoutput query="getdata" >#getdata.data#</cfoutput>

will show all the values one at a time, you do not have to do an array.
Till the session completes the values will stay in the query "getdata"

Bhaskar



Fri, 05 Nov 1999 03:00:00 GMT
 anybody know cold fusion?

Quote:

> anybody know cold fusion?
> have some questions.
> don't quite understand what happens when you perform a query that will
> return multiple rusults.  does it create some sort of array?
> for instance, if you perform a cfquery like this:
>         <cfquery datasource="database" name="getdata">
>                 select data
>                 from table
>                 where field = "somethingerother"
>         </cfquery>
> and there are several records where field = "somethingerother", what gets
> put in the #getdata.data# variable and how do you retrieve it record at a
> time?

I'm not familiar with the latest version of Cold Fusion, but in the
earlier ones, you had the tags <DBOUTPUT [QUERY=...]> and </DBOUTPUT> to
define the 'loop' where the records are processed. I found the manuals
fairly good, but maybe they've worsened lately. There's also a lot of
discussion going on att the Allaire web-site ( http://www.allaire.com ).
They've got something fairly similar to newsgroups (but with a web
interface) with threads and such where you can ask questions. I've found
this to be an extremely good source for information.

Anyway, it should look something like this; (This first snippet of code
may contain bugs - I snipped it from a real app and mutilated it a bit
on the fly as it didn't show exactly what I was interested in.)

[Example 1, simple table output]

<DBQUERY
        NAME="QryTransit"
        DATASOURCE="OrcaJFK"
        SQL="{ call MyStoredProcedure (#StartDate#, #EndDate#, #LargerThan#)

Quote:
}">

<TABLE BORDER=0 CELLSPACING=4>
  <TR>
    <TH ALIGN=LEFT>Mfg</TH>
    <TH ALIGN=RIGHT>Items</TH>
    <TH ALIGN=RIGHT>LStack</TH>
    <TH ALIGN=RIGHT>RStack</TH>
    <TH ALIGN=RIGHT>VStack</TH>
  </TR>

<!-- Now, here comes the actual looping.... -->

  <DBOUTPUT QUERY="QryTransit">
  <TR>
    <TD>#Mfg#</TD>
    <TD ALIGN=RIGHT>#Number#</TD>
    <TD ALIGN=RIGHT>#NumberFormat(LStack)#</TD>
    <TD ALIGN=RIGHT>#NumberFormat(RStack)#</TD>
    <TD ALIGN=RIGHT>#NumberFormat(VStack)#</TD>
  </TR>
  </DBOUTPUT>

<!-- And here it ends .... -->

</TABLE>

[Example 2, using DBML to conditionally modify output]

<DBQUERY
        NAME="Subjects"
        DATASOURCE="HASTUR"                    
        SQL="SELECT * FROM ht_qrySubjects WHERE DomID = #htDomID#">

<CENTER>|

<!-- here's the looping again -->

<DBOUTPUT QUERY="Subjects">
  <DBIF #IsDom# is "0">
    <A TARGET="body"
HREF="/cgi-shl/dbml.exe?Action=Query&Template=HASTUR/body.dbm&htDomID=#KeywordID#">#Keyword#</A>
|
  <DBELSE>
    <A TARGET="_parent"
HREF="/cgi-shl/dbml.exe?Action=Query&Template=HASTUR/main.dbm&htDomID=#KeywordID#">#Keyword#</A>
|
  </DBIF>
</DBOUTPUT>
</CENTER>

Note that we compare a field in the query ('IsDom') to a value ('0').

Regards
/Joachim

Quote:
> --
> "eat of me for i am stake"

> www.cias.net/texorcist
> i bought vio vpc i.glasses!;  now what?

--
Lente Impelle.



Fri, 05 Nov 1999 03:00:00 GMT
 anybody know cold fusion?

Quote:

> anybody know cold fusion?
> have some questions.
> don't quite understand what happens when you perform a query that will
> return multiple rusults.  does it create some sort of array?
> for instance, if you perform a cfquery like this:
>         <cfquery datasource="database" name="getdata">
>                 select data
>                 from table
>                 where field = "somethingerother"
>         </cfquery>
> and there are several records where field = "somethingerother", what gets
> put in the #getdata.data# variable and how do you retrieve it record at a
> time?

> --
> "eat of me for i am stake"

> www.cias.net/texorcist
> i bought vio vpc i.glasses!;  now what?

<CFOUTPUT> and <CFTABLE> handle query results (arrays), with attributes
for Query, Maxrows, Group and Startrow.

Jim
--
+----------------------------------------------------------------------+
| Jim Wilson      Applied Expertise, Inc.     V: (703) 516-0911        |
| President       Arlington, {*filter*}ia         F: (703) 516-0918        |

+----------------------------------------------------------------------+



Sat, 06 Nov 1999 03:00:00 GMT
 anybody know cold fusion?

Quote:

> anybody know cold fusion?
> have some questions.
> don't quite understand what happens when you perform a query that will
> return multiple rusults.  does it create some sort of array?
> for instance, if you perform a cfquery like this:
>         <cfquery datasource="database" name="getdata">
>                 select data
>                 from table
>                 where field = "somethingerother"
>         </cfquery>
> and there are several records where field = "somethingerother", what gets
> put in the #getdata.data# variable and how do you retrieve it record at a
> time?

Basically it creates a view called getdata. You can spit it back out
with CFOUTPUT or CFLOOP using a QUERY="getdata".
Like this...

<CFOUTPUT QUERY="getdata">
        My data is #data#<br>
</CFOUTPUT>

If your data was "cats", "dogs", "kangaroos" then you'd get back:

        My data is cats<br>
        My data is dogs<br>
        My data is kangaroos<br>

While we're on the subject, I don't suppose you know SQL well enough to
get this to work? :)
It's embedded in a thick page of cold fusion at the moment.

                        UPDATE Users
                                SET Referrals = ( SELECT Count(*) FROM Users WHERE Referer_ID = 2 )
                                WHERE User_ID = 2

Quote:
> --
> "eat of me for i am stake"

> www.cias.net/texorcist
> i bought vio vpc i.glasses!;  now what?

Lewis Sellers, contract Multimedia Website Developer

http://www.public.usit.net/lsellers/ (New! for 1997)
http://www.javascripts.com/ (Work. Ug.)

(If I don't get back to you within a month, I'm out of prozac in some
dark corner somewhere screaming things unintelligable, but with a
curiously thick sumerian accent.)


Sat, 06 Nov 1999 03:00:00 GMT
 anybody know cold fusion?

Using an output table will show every record that has those qualities,
otherwise it should just return the first record that it finds that fits.
There is a <CFTABLE></CFTABLE> tag that is a very simple to use to display
all the records retrieved.  I also reccommend using Allaire's support
forum.  It can be somewhat slow, but there is a lot of material covered
there.

Good luck,
Marty Happ



Tue, 16 Nov 1999 03:00:00 GMT
 
 [ 6 post ] 

 Relevant Pages 

1. CA-Orange County-261514--Cold Fusion-Javascript-C-C++-ORACLE-SQLSERVER-Cold Fusion Developer

2. CA-Orange County-261514--Cold Fusion-Javascript-C-C++-ORACLE-SQLSERVER-Cold Fusion Developer

3. VA-Arlington-260457--Cold Fusion-HTML-ORACLE-Javascript-Cold Fusion Programmer

4. VA-Herndon-241647--Cold Fusion-Javascript-DHTML-Mac TCP-ORACLE-Cold Fusion Developer

5. GA-Atlanta-113141--Cold Fusion-HTML-ORACLE-UNIX-C-Intranet-Intranet Developers - Cold Fusion

6. VA-Herndon-241647--Cold Fusion-Javascript-DHTML-Mac TCP-ORACLE-Cold Fusion Developer

7. VA-Herndon-255862--Cold Fusion-Javascript-DHTML-MS ACCESS-ORACLE-Cold Fusion Developer

8. VA-McLean-242990--Cold Fusion-ORACLE-SQLSERVER-SYBASE-Cold Fusion Application Developer

9. VA-McLean-242990--Cold Fusion-ORACLE-SQLSERVER-SYBASE-Cold Fusion Application Developer

10. Know Some Good Cold Fusion/msSQL Driven Sites?

11. AZ-Tucson-267548--Web Development-Cold Fusion-SQL-HTML-Developer 2000-ORACLE-Web Developer - Cold Fusion, SQL, and HT

12. Good argument for Sybase and Cold Fusion over MS SQL and Cold Fusion?


 
Powered by phpBB® Forum Software