Ask a Question related to Dreamweaver AppDev, Design and Development.
-
siti_nana #1
problem with repeat region
i'm currently doing an ecommerce website for my project. using dreamweaver and
access for the database btw. so here's a brief description of how the website
works.
i have a meatPoultry.asp page which consists of the links to all the recipes
stored in the database. once clicked on a recipe link, it goes to the detail
page recipe.asp. i have a recordset on this recipe.asp page, of which i (INNER)
join 2 tables -Recipes and Ingredients. the relationship between these 2 tables
is one-to-many. this recipe.asp page is to show the recipe title, ingredients
and the method for the recipe selected.
i added the repeat region behaviour onto the ingredients row. the problem here
is that, when previewed in browser, all the records in the Ingredients table is
shown. i only want the ingredients to the recipe selected to be shown.
i don't think the problem lies with my database cos when i take away the
repeat region, the first record (in Ingredients table) of the recipe selected,
is shown, but i need all the ingredients to appear so the obvious thing to do
is to use Repeat Region right? or something else?
i've attached the code. someone help me pleassssseeeee......getting desperate
here....:frown;
<%
Dim rsRecipe
Dim rsRecipe_numRows
Set rsRecipe = Server.CreateObject("ADODB.Recordset")
rsRecipe.ActiveConnection = MM_conn_cyberKitchen_STRING
rsRecipe.Source = "SELECT * FROM Recipes INNER JOIN Ingredients ON
Recipes.RecipeID = Ingredients.RecipeID"
rsRecipe.CursorType = 0
rsRecipe.CursorLocation = 2
rsRecipe.LockType = 1
rsRecipe.Open()
rsRecipe_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
rsRecipe_numRows = rsRecipe_numRows + Repeat1__numRows
%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats
variables
Dim rsRecipe_total
Dim rsRecipe_first
Dim rsRecipe_last
' set the record count
rsRecipe_total = rsRecipe.RecordCount
' set the number of rows displayed on this page
If (rsRecipe_numRows < 0) Then
rsRecipe_numRows = rsRecipe_total
Elseif (rsRecipe_numRows = 0) Then
rsRecipe_numRows = 1
End If
' set the first and last displayed record
rsRecipe_first = 1
rsRecipe_last = rsRecipe_first + rsRecipe_numRows - 1
' if we have the correct record count, check the other stats
If (rsRecipe_total <> -1) Then
If (rsRecipe_first > rsRecipe_total) Then
rsRecipe_first = rsRecipe_total
End If
If (rsRecipe_last > rsRecipe_total) Then
rsRecipe_last = rsRecipe_total
End If
If (rsRecipe_numRows > rsRecipe_total) Then
rsRecipe_numRows = rsRecipe_total
End If
End If
%>
<%
Dim MM_paramName
%>
<%
' *** Move To Record and Go To Record: declare variables
Dim MM_rs
Dim MM_rsCount
Dim MM_size
Dim MM_uniqueCol
Dim MM_offset
Dim MM_atTotal
Dim MM_paramIsDefined
Dim MM_param
Dim MM_index
Set MM_rs = rsRecipe
MM_rsCount = rsRecipe_total
MM_size = rsRecipe_numRows
MM_uniqueCol = "RecipeID"
MM_paramName = "RecipeID"
MM_offset = 0
MM_atTotal = false
MM_paramIsDefined = false
If (MM_paramName <> "") Then
MM_paramIsDefined = (Request.QueryString(MM_paramName) <> "")
End If
%>
<%
' *** Move To Specific Record: handle detail parameter
If (MM_paramIsDefined And MM_rsCount <> 0) Then
' get the value of the parameter
MM_param = Request.QueryString(MM_paramName)
' find the record with the unique column value equal to the parameter value
MM_offset = 0
Do While (Not MM_rs.EOF)
If (CStr(MM_rs.Fields.Item(MM_uniqueCol).Value) = MM_param) Then
Exit Do
End If
MM_offset = MM_offset + 1
MM_rs.MoveNext
Loop
' if not found, set the number of records and reset the cursor
If (MM_rs.EOF) Then
If (MM_rsCount < 0) Then
MM_rsCount = MM_offset
End If
If (MM_size < 0 Or MM_size > MM_offset) Then
MM_size = MM_offset
End If
MM_offset = 0
' reset the cursor to the beginning
If (MM_rs.CursorType > 0) Then
MM_rs.MoveFirst
Else
MM_rs.Close
MM_rs.Open
End If
End If
End If
%>
<%
' *** Move To Record: if we dont know the record count, check the display range
If (MM_rsCount = -1) Then
' walk to the end of the display range for this page
MM_index = MM_offset
While (Not MM_rs.EOF And (MM_size < 0 Or MM_index < MM_offset + MM_size))
MM_rs.MoveNext
MM_index = MM_index + 1
Wend
' if we walked off the end of the recordset, set MM_rsCount and MM_size
If (MM_rs.EOF) Then
MM_rsCount = MM_index
If (MM_size < 0 Or MM_size > MM_rsCount) Then
MM_size = MM_rsCount
End If
End If
' if we walked off the end, set the offset based on page size
If (MM_rs.EOF And Not MM_paramIsDefined) Then
If (MM_offset > MM_rsCount - MM_size Or MM_offset = -1) Then
If ((MM_rsCount Mod MM_size) > 0) Then
MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
Else
MM_offset = MM_rsCount - MM_size
End If
End If
End If
' reset the cursor to the beginning
If (MM_rs.CursorType > 0) Then
MM_rs.MoveFirst
Else
MM_rs.Requery
End If
' move the cursor to the selected record
MM_index = 0
While (Not MM_rs.EOF And MM_index < MM_offset)
MM_rs.MoveNext
MM_index = MM_index + 1
Wend
End If
%>
<%
' *** Move To Record: update recordset stats
' set the first and last displayed record
rsRecipe_first = MM_offset + 1
rsRecipe_last = MM_offset + MM_size
If (MM_rsCount <> -1) Then
If (rsRecipe_first > MM_rsCount) Then
rsRecipe_first = MM_rsCount
End If
If (rsRecipe_last > MM_rsCount) Then
rsRecipe_last = MM_rsCount
End If
End If
' set the boolean used by hide region to check if we are on the last record
MM_atTotal = (MM_rsCount <> -1 And MM_offset + MM_size >= MM_rsCount)
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><font face="Geneva, Arial, Helvetica,
sans-serif"><strong><%=(rsRecipe.Fields.Item("RecipeNam e").Value)%></strong></fo
nt></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<br />
<%
While ((Repeat1__numRows <> 0) AND (NOT rsRecipe.EOF))
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><%=(rsRecipe.Fields.Item("IngredientQty").Valu e)%>
<%=(rsRecipe.Fields.Item("IngredientName").Value)% ></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsRecipe.MoveNext()
Wend
%>
<br />
<p> </p>
</body>
</html>
<%
rsRecipe.Close()
Set rsRecipe = Nothing
%>
siti_nana Guest
-
Nested Repeat region
Before Upgrading to CS I used to use the Extension from those clever peps at InterAkt to do this but now for some reason its incompatible!!! ... -
repeat region
Hi.. I use repeat region to view only 10 records at a time, so how can I have another link that when user click on next it will go to another 10 of... -
Repeat Region Question
I have a repeat region section that contains news blips. I would like a horizonal rule beween them, but NOT the very last one. Is there a way to... -
repeat region across the page?
Maybe a really silly question but my little brain could not work this out. How do you repeat a region across and down the page at the same time?... -
php repeat region
Hey guys, question about PHP, I'm trying to help out a friend but I don't really know anything about php. I'm also pretty amaturish at asp. I... -
Joseph Lowery #2
Re: problem with repeat region
There is no WHERE clause in your SQL - the WHERE clause acts as a filter to
limit the recordset. You'll need to pick up a querystring variable passed
from the master page to the detail page and use that in the WHERE clause.
Best - Joe
"siti_nana" <webforumsuser@macromedia.com> wrote in message
news:cv9q31$mdt$1@forums.macromedia.com...and> i'm currently doing an ecommerce website for my project. using dreamweaverwebsite> access for the database btw. so here's a brief description of how therecipes> works.
>
> i have a meatPoultry.asp page which consists of the links to all thedetail> stored in the database. once clicked on a recipe link, it goes to the(INNER)> page recipe.asp. i have a recordset on this recipe.asp page, of which itables> join 2 tables -Recipes and Ingredients. the relationship between these 2ingredients> is one-to-many. this recipe.asp page is to show the recipe title,here> and the method for the recipe selected.
>
> i added the repeat region behaviour onto the ingredients row. the problemtable is> is that, when previewed in browser, all the records in the Ingredientsselected,> shown. i only want the ingredients to the recipe selected to be shown.
>
> i don't think the problem lies with my database cos when i take away the
> repeat region, the first record (in Ingredients table) of the recipedo> is shown, but i need all the ingredients to appear so the obvious thing todesperate> is to use Repeat Region right? or something else?
>
> i've attached the code. someone help me pleassssseeeee......gettingvalue> here....:frown;
>
> <%
> Dim rsRecipe
> Dim rsRecipe_numRows
>
> Set rsRecipe = Server.CreateObject("ADODB.Recordset")
> rsRecipe.ActiveConnection = MM_conn_cyberKitchen_STRING
> rsRecipe.Source = "SELECT * FROM Recipes INNER JOIN Ingredients ON
> Recipes.RecipeID = Ingredients.RecipeID"
> rsRecipe.CursorType = 0
> rsRecipe.CursorLocation = 2
> rsRecipe.LockType = 1
> rsRecipe.Open()
>
> rsRecipe_numRows = 0
> %>
> <%
> Dim Repeat1__numRows
> Dim Repeat1__index
>
> Repeat1__numRows = -1
> Repeat1__index = 0
> rsRecipe_numRows = rsRecipe_numRows + Repeat1__numRows
> %>
> <%
> ' *** Recordset Stats, Move To Record, and Go To Record: declare stats
> variables
>
> Dim rsRecipe_total
> Dim rsRecipe_first
> Dim rsRecipe_last
>
> ' set the record count
> rsRecipe_total = rsRecipe.RecordCount
>
> ' set the number of rows displayed on this page
> If (rsRecipe_numRows < 0) Then
> rsRecipe_numRows = rsRecipe_total
> Elseif (rsRecipe_numRows = 0) Then
> rsRecipe_numRows = 1
> End If
>
> ' set the first and last displayed record
> rsRecipe_first = 1
> rsRecipe_last = rsRecipe_first + rsRecipe_numRows - 1
>
> ' if we have the correct record count, check the other stats
> If (rsRecipe_total <> -1) Then
> If (rsRecipe_first > rsRecipe_total) Then
> rsRecipe_first = rsRecipe_total
> End If
> If (rsRecipe_last > rsRecipe_total) Then
> rsRecipe_last = rsRecipe_total
> End If
> If (rsRecipe_numRows > rsRecipe_total) Then
> rsRecipe_numRows = rsRecipe_total
> End If
> End If
> %>
>
> <%
> Dim MM_paramName
> %>
> <%
> ' *** Move To Record and Go To Record: declare variables
>
> Dim MM_rs
> Dim MM_rsCount
> Dim MM_size
> Dim MM_uniqueCol
> Dim MM_offset
> Dim MM_atTotal
> Dim MM_paramIsDefined
>
> Dim MM_param
> Dim MM_index
>
> Set MM_rs = rsRecipe
> MM_rsCount = rsRecipe_total
> MM_size = rsRecipe_numRows
> MM_uniqueCol = "RecipeID"
> MM_paramName = "RecipeID"
> MM_offset = 0
> MM_atTotal = false
> MM_paramIsDefined = false
> If (MM_paramName <> "") Then
> MM_paramIsDefined = (Request.QueryString(MM_paramName) <> "")
> End If
> %>
> <%
> ' *** Move To Specific Record: handle detail parameter
>
> If (MM_paramIsDefined And MM_rsCount <> 0) Then
>
> ' get the value of the parameter
> MM_param = Request.QueryString(MM_paramName)
>
> ' find the record with the unique column value equal to the parameterrange> MM_offset = 0
> Do While (Not MM_rs.EOF)
> If (CStr(MM_rs.Fields.Item(MM_uniqueCol).Value) = MM_param) Then
> Exit Do
> End If
> MM_offset = MM_offset + 1
> MM_rs.MoveNext
> Loop
>
> ' if not found, set the number of records and reset the cursor
> If (MM_rs.EOF) Then
> If (MM_rsCount < 0) Then
> MM_rsCount = MM_offset
> End If
> If (MM_size < 0 Or MM_size > MM_offset) Then
> MM_size = MM_offset
> End If
> MM_offset = 0
>
> ' reset the cursor to the beginning
> If (MM_rs.CursorType > 0) Then
> MM_rs.MoveFirst
> Else
> MM_rs.Close
> MM_rs.Open
> End If
> End If
>
> End If
> %>
> <%
> ' *** Move To Record: if we dont know the record count, check the displayMM_size))>
> If (MM_rsCount = -1) Then
>
> ' walk to the end of the display range for this page
> MM_index = MM_offset
> While (Not MM_rs.EOF And (MM_size < 0 Or MM_index < MM_offset +record> MM_rs.MoveNext
> MM_index = MM_index + 1
> Wend
>
> ' if we walked off the end of the recordset, set MM_rsCount and MM_size
> If (MM_rs.EOF) Then
> MM_rsCount = MM_index
> If (MM_size < 0 Or MM_size > MM_rsCount) Then
> MM_size = MM_rsCount
> End If
> End If
>
> ' if we walked off the end, set the offset based on page size
> If (MM_rs.EOF And Not MM_paramIsDefined) Then
> If (MM_offset > MM_rsCount - MM_size Or MM_offset = -1) Then
> If ((MM_rsCount Mod MM_size) > 0) Then
> MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
> Else
> MM_offset = MM_rsCount - MM_size
> End If
> End If
> End If
>
> ' reset the cursor to the beginning
> If (MM_rs.CursorType > 0) Then
> MM_rs.MoveFirst
> Else
> MM_rs.Requery
> End If
>
> ' move the cursor to the selected record
> MM_index = 0
> While (Not MM_rs.EOF And MM_index < MM_offset)
> MM_rs.MoveNext
> MM_index = MM_index + 1
> Wend
> End If
> %>
> <%
> ' *** Move To Record: update recordset stats
>
> ' set the first and last displayed record
> rsRecipe_first = MM_offset + 1
> rsRecipe_last = MM_offset + MM_size
>
> If (MM_rsCount <> -1) Then
> If (rsRecipe_first > MM_rsCount) Then
> rsRecipe_first = MM_rsCount
> End If
> If (rsRecipe_last > MM_rsCount) Then
> rsRecipe_last = MM_rsCount
> End If
> End If
>
> ' set the boolean used by hide region to check if we are on the last/>> MM_atTotal = (MM_rsCount <> -1 And MM_offset + MM_size >= MM_rsCount)
> %>
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <title>Untitled Document</title>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"sans-serif"><strong><%=(rsRecipe.Fields.Item("RecipeNam e").Value)%></strong>> </head>
>
> <body>
>
> <table width="100%" border="0" cellspacing="0" cellpadding="0">
>
>
> <tr>
> <td><font face="Geneva, Arial, Helvetica,
>
</fo> nt></td>
> </tr>
> <tr>
> <td> </td>
> </tr>
> </table>
>
>
> <br />
> <%
> While ((Repeat1__numRows <> 0) AND (NOT rsRecipe.EOF))
> %>
> <table width="100%" border="0" cellpadding="0" cellspacing="0">
> <tr>
> <td><%=(rsRecipe.Fields.Item("IngredientQty").Valu e)%>
> <%=(rsRecipe.Fields.Item("IngredientName").Value)% ></td>
> </tr>
> <tr>
> <td> </td>
> </tr>
> </table>
> <%
> Repeat1__index=Repeat1__index+1
> Repeat1__numRows=Repeat1__numRows-1
> rsRecipe.MoveNext()
> Wend
> %>
> <br />
> <p> </p>
> </body>
> </html>
> <%
> rsRecipe.Close()
> Set rsRecipe = Nothing
> %>
>
Joseph Lowery Guest
-
siti_nana #3
Re: problem with repeat region
can you give an example of what you meant? maybe in the form of codes or something.....would really appreciate it.... i'm not very code savvvy
siti_nana Guest
-
samkry #4
Re: problem with repeat region
Kak long..
rsRecipe.Source = "SELECT * FROM Recipes INNER JOIN Ingredients ON
Recipes.RecipeID = Ingredients.RecipeID"
from ur sql script there is no where clause so, ur above statementt will grab
whatever values stored in ur db, so u have to filter it
try putting as this one
rsRecipe.Source = "SELECT * FROM Recipes INNER JOIN Ingredients ON
Recipes.RecipeID = Ingredients.RecipeID
where columnname[defineurcolumnhere]='ur values here'
samkry Guest
-



Reply With Quote

