Ask a Question related to Dreamweaver AppDev, Design and Development.
-
ceaseanddesist #1
looped through records that = a value
i have a recordset that has values 1,2,3 in an field "intarea"
my questions is how do i loop through all the records that = 1 then loop
through all records that = 2
i want to do this rather than creating 3 seperate recordsets is this
possible ?
adam
ceaseanddesist Guest
-
can't get flash to loop through looped info from php
I have php using a for loop to gather sets of info from a mysql database and then send it over to flash. I can't get Flash to loop through it and... -
Looped Array Element Deletion
I want to loop through a structure of arrays using CFScript to delete an element in the same position of each array. Here is a snipet of code I... -
free looped audio every week
FYI, GreatBigMedia.com is giving away a free audio loop every week that you can use for your flash projects. Its worth checking out. -
My looped MP3 is not looping!
Hello I have an MP3 that I am using as background music for a Director file. I have clicked on the item in the cast and checked the "Loop" box... -
looped cloud animation
hi tht is the problem of loading u hav to add preloader i had seen ur movie after loading all frames its working properly u add foll... -
Lionstone #2
Re: looped through records that = a value
Use your order by clause
ORDER BY intarea, <your existing order by list>
Then, before using each record, make sure the value of intarea hasn't
changed.
"ceaseanddesist" <poorleno@ukip.com> wrote in message
news:d6s24b$ndh$1@forums.macromedia.com...>i have a recordset that has values 1,2,3 in an field "intarea"
>
> my questions is how do i loop through all the records that = 1 then loop
> through all records that = 2
>
> i want to do this rather than creating 3 seperate recordsets is this
> possible ?
>
> adam
>
Lionstone Guest
-
ceaseanddesist #3
Re: looped through records that = a value
lionstone thanks for the reply im using the following logic ( correct me if
im wrong ) however it just returns all irrelevant of the intmaincatid and
then a Either BOF or EOF error .. any suggestions ?
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/website.asp" -->
<%
Dim rspages
Dim rspages_numRows
Set rspages = Server.CreateObject("ADODB.Recordset")
rspages.ActiveConnection = MM_website_STRING
rspages.Source = "SELECT intid, intmaincatid, intsubcatid, strpagename FROM
dbo.tblpages"
rspages.CursorType = 2
rspages.CursorLocation = 2
rspages.LockType = 1
rspages.Open()
rspages_numRows = 0
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
About us
<%
While NOT rspages.EOF AND rspages.Fields.Item("intmaincatid").Value = "1"
%>
<%=(rspages.Fields.Item("strpagename").Value)%>
<%
rspages.MoveNext()
Wend
%>
Campaigns
<%
While NOT rspages.EOF AND rspages.Fields.Item("intmaincatid").Value = "2"
%>
<%=(rspages.Fields.Item("strpagename").Value)%>
<%
rspages.MoveNext()
Wend
%>
</body>
</html>
<%
rspages.Close()
Set rspages = Nothing
%>
"Lionstone" <HIDElionstoneHIDE@HIDEhush.com> wrote in message
news:d6snml$ss3$1@forums.macromedia.com...> Use your order by clause
> ORDER BY intarea, <your existing order by list>
>
> Then, before using each record, make sure the value of intarea hasn't
> changed.
>
> "ceaseanddesist" <poorleno@ukip.com> wrote in message
> news:d6s24b$ndh$1@forums.macromedia.com...>>>i have a recordset that has values 1,2,3 in an field "intarea"
>>
>> my questions is how do i loop through all the records that = 1 then loop
>> through all records that = 2
>>
>> i want to do this rather than creating 3 seperate recordsets is this
>> possible ?
>>
>> adam
>>
>
ceaseanddesist Guest
-
Lionstone #4
Re: looped through records that = a value
You need to add ORDER BY to your query in the recordset.
rspages.Source = "SELECT intid, intmaincatid, intsubcatid, strpagename FROM
dbo.tblpages ORDER BY intmaincatid"
If the catid is an integer (which I'm assuming from the "int" at the
beginning), no need to compare it to a string. Instead:
<%
While NOT rspages.EOF AND rspages.Fields.Item("intmaincatid").Value = 1
%>
I don't think it will fail when compared to "1" instead of 1, but why take
chances?
Now, VBScript does something which drives a lot of programmers nuts - it
doesn't short-circuit on boolean comparisons. That is, in the above
statement, if rspages is, in fact, empty, it will still try to access the
field "intmaincatid" even though the AND comparison is already false.
You're forced to nest the comparisons to avoid EOF errors:
<%
If NOT rspages.EOF Then
Do While rspages.Fields.Item("intmaincatid").Value = 1
%>
Do Stuff
<%
Loop
End If
%>
"ceaseanddesist" <poorleno@ukip.com> wrote in message
news:d6spm0$2rt$1@forums.macromedia.com...> lionstone thanks for the reply im using the following logic ( correct me
> if im wrong ) however it just returns all irrelevant of the intmaincatid
> and then a Either BOF or EOF error .. any suggestions ?
>
> <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
> <!--#include file="Connections/website.asp" -->
> <%
> Dim rspages
> Dim rspages_numRows
>
> Set rspages = Server.CreateObject("ADODB.Recordset")
> rspages.ActiveConnection = MM_website_STRING
> rspages.Source = "SELECT intid, intmaincatid, intsubcatid, strpagename
> FROM dbo.tblpages"
> rspages.CursorType = 2
> rspages.CursorLocation = 2
> rspages.LockType = 1
> rspages.Open()
>
> rspages_numRows = 0
> %>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "http://www.w3.org/TR/html4/loose.dtd">
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> <title>Untitled Document</title>
> </head>
>
> <body>
> About us
> <%
> While NOT rspages.EOF AND rspages.Fields.Item("intmaincatid").Value = "1"
> %>
> <%=(rspages.Fields.Item("strpagename").Value)%>
> <%
> rspages.MoveNext()
> Wend
> %>
> Campaigns
> <%
> While NOT rspages.EOF AND rspages.Fields.Item("intmaincatid").Value = "2"
> %>
> <%=(rspages.Fields.Item("strpagename").Value)%>
> <%
> rspages.MoveNext()
> Wend
> %>
>
>
> </body>
> </html>
> <%
> rspages.Close()
> Set rspages = Nothing
> %>
>
>
> "Lionstone" <HIDElionstoneHIDE@HIDEhush.com> wrote in message
> news:d6snml$ss3$1@forums.macromedia.com...>>> Use your order by clause
>> ORDER BY intarea, <your existing order by list>
>>
>> Then, before using each record, make sure the value of intarea hasn't
>> changed.
>>
>> "ceaseanddesist" <poorleno@ukip.com> wrote in message
>> news:d6s24b$ndh$1@forums.macromedia.com...>>>>>i have a recordset that has values 1,2,3 in an field "intarea"
>>>
>>> my questions is how do i loop through all the records that = 1 then
>>> loop through all records that = 2
>>>
>>> i want to do this rather than creating 3 seperate recordsets is this
>>> possible ?
>>>
>>> adam
>>>
>>
>
Lionstone Guest
-
ceaseanddesist #5
Re: looped through records that = a value
cheers much appreciated
adam
"Lionstone" <HIDElionstoneHIDE@HIDEhush.com> wrote in message
news:d6t0eq$dck$1@forums.macromedia.com...> You need to add ORDER BY to your query in the recordset.
> rspages.Source = "SELECT intid, intmaincatid, intsubcatid, strpagename
> FROM dbo.tblpages ORDER BY intmaincatid"
>
> If the catid is an integer (which I'm assuming from the "int" at the
> beginning), no need to compare it to a string. Instead:
> <%
> While NOT rspages.EOF AND rspages.Fields.Item("intmaincatid").Value = 1
> %>
> I don't think it will fail when compared to "1" instead of 1, but why take
> chances?
>
> Now, VBScript does something which drives a lot of programmers nuts - it
> doesn't short-circuit on boolean comparisons. That is, in the above
> statement, if rspages is, in fact, empty, it will still try to access the
> field "intmaincatid" even though the AND comparison is already false.
> You're forced to nest the comparisons to avoid EOF errors:
>
> <%
> If NOT rspages.EOF Then
> Do While rspages.Fields.Item("intmaincatid").Value = 1
> %>
> Do Stuff
> <%
> Loop
> End If
> %>
>
>
> "ceaseanddesist" <poorleno@ukip.com> wrote in message
> news:d6spm0$2rt$1@forums.macromedia.com...>>> lionstone thanks for the reply im using the following logic ( correct me
>> if im wrong ) however it just returns all irrelevant of the intmaincatid
>> and then a Either BOF or EOF error .. any suggestions ?
>>
>> <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
>> <!--#include file="Connections/website.asp" -->
>> <%
>> Dim rspages
>> Dim rspages_numRows
>>
>> Set rspages = Server.CreateObject("ADODB.Recordset")
>> rspages.ActiveConnection = MM_website_STRING
>> rspages.Source = "SELECT intid, intmaincatid, intsubcatid, strpagename
>> FROM dbo.tblpages"
>> rspages.CursorType = 2
>> rspages.CursorLocation = 2
>> rspages.LockType = 1
>> rspages.Open()
>>
>> rspages_numRows = 0
>> %>
>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
>> "http://www.w3.org/TR/html4/loose.dtd">
>> <html>
>> <head>
>> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
>> <title>Untitled Document</title>
>> </head>
>>
>> <body>
>> About us
>> <%
>> While NOT rspages.EOF AND rspages.Fields.Item("intmaincatid").Value = "1"
>> %>
>> <%=(rspages.Fields.Item("strpagename").Value)%>
>> <%
>> rspages.MoveNext()
>> Wend
>> %>
>> Campaigns
>> <%
>> While NOT rspages.EOF AND rspages.Fields.Item("intmaincatid").Value = "2"
>> %>
>> <%=(rspages.Fields.Item("strpagename").Value)%>
>> <%
>> rspages.MoveNext()
>> Wend
>> %>
>>
>>
>> </body>
>> </html>
>> <%
>> rspages.Close()
>> Set rspages = Nothing
>> %>
>>
>>
>> "Lionstone" <HIDElionstoneHIDE@HIDEhush.com> wrote in message
>> news:d6snml$ss3$1@forums.macromedia.com...>>>>> Use your order by clause
>>> ORDER BY intarea, <your existing order by list>
>>>
>>> Then, before using each record, make sure the value of intarea hasn't
>>> changed.
>>>
>>> "ceaseanddesist" <poorleno@ukip.com> wrote in message
>>> news:d6s24b$ndh$1@forums.macromedia.com...
>>>>i have a recordset that has values 1,2,3 in an field "intarea"
>>>>
>>>> my questions is how do i loop through all the records that = 1 then
>>>> loop through all records that = 2
>>>>
>>>> i want to do this rather than creating 3 seperate recordsets is this
>>>> possible ?
>>>>
>>>> adam
>>>>
>>>
>>>
>>
>
ceaseanddesist Guest



Reply With Quote

