View Full Version : Multiple Repeat regions and Recordsets question
mustang_sally_85344510
05-04-2009, 11:46 AM
I am building a display page and it involves multiple repeat regions on the same page.
The display page... displays from a link.. "go to detail page" server behavior.
I am trying to display database information by visitorID ....
I am trying to get information from 4 tables....of the specific individual user,
using visitorID as the common variable connecting the 4 tables.
I cannot use the same recordset for all the repeat regions...
What would be the proper way to queery for the desired results?
Danilo Celic
05-04-2009, 02:09 PM
If you cannot use the same recordset for all of the repeats, then you can create a recordset for each repeat region and filter that recordset as appropriate. But, it's not really clear to me exactly what you're trying to do, so I may be missing something in your explanation.
mustang_sally_85344510
05-04-2009, 06:09 PM
Hi again,
I have a page called "centers.php" that has a "go to detail page" link.
Which carries the "colname" to the centersdetail.php page.
On that detail page I want to have all of the information that that id number has submitted to the site. For example, tournaments, leagues, coupons, center. Filtered by visitorID
The problem is DW will not allow an additional repeat region server behavior. It only allows 1 repeat region from a recordset.
I have attached the revelent recordsets and pages,...hopefully you can see what I am doing wrong. Or should I say...what I should be doing.
I do get the first repeat region to work,...but cannot bring up the correct individual "colname" on the other recordset repeat regions.
Thank you in advance for any help and suggestions you can give me.
Danilo Celic
05-05-2009, 07:53 AM
Well a quick way to get this to work would be to create duplicate recordsets using the same settings. In fact with Recordsets, you can copy and paste them in the Server Behaviors panel. Select your recordset, right click, select copy, then right click and select Paste. You'll now have a new recordset. You can edit it to give it a name that you'll recognize better, if you feel like it. You can then use the "new" recordset as the one to repeat over for the Repeat Region you need to have on your page.
Or, you can "reset" the recordset back to the first result item, and then wrap the area you want to repeat with a copy of the Dreamweaver repeating code.
To reset your recordset back to the start of the recordset use code similar to the following (replace Recordset1 with the name of your recordset). This code will need to be inserted immediately above any repeat region you want to add, so if you have 5 repeat regions, then you'll have this on the page 4 times, no need to have it prior to the first one on the page, as the recordset is already at the beginning:
<?php
$rows = mysql_num_rows($Recordset1);
if($rows > 0) {
mysql_data_seek($Recordset1, 0);
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
}
?>
Then any region you want to repeat, add this before the start of the region:
<?php do { ?>
and this after (again replace Recordset1 with the name of your recordset):
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
mustang_sally_85344510
05-05-2009, 11:57 AM
Hello again,
I tried making one giant recordset and I couldn't get it to work properly.
It brought up inaccurate information.
I think one of my many problems is in the recordset ...
I need to change the criteria in the WHERE clause for each table.
For example:
WHERE centerId = colname AND centers.VisitorID = tourneyad.VisitorID
(for one table)
WHERE centerId = colname AND centers.VisitorID = leagues.VisitorID
(another table)
WHERE centerId = colname AND centers.VisitorID = coupon.VisitorID
(another table)
I tried using AND operator for one giant WHERE clause...and I need a situation where if a visitor doesn't have something in one of the other tables...it will still bring up their other entered information.
Thank you again, for your help.
mustang_sally_85344510
05-05-2009, 12:30 PM
HI THERE~:)
Thank you for all your help.
After responding to your help...
I discovered that I was putting too much info in my first (one to copy) recordset.
After I copied it...than made the adjustments in my WHERE clause.
It is working good so far.
Again, thank you for your posts and all your GREAT HELP! :)
robert254422
07-25-2010, 04:14 AM
<?php
$rows = mysql_num_rows($Recordset1);
if($rows > 0) {
mysql_data_seek($Recordset1, 0);
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
}
?>
This post has helped me a great deal... I was just wondering if this method could be used to NOT reset it all the way but point it to a specific row in the recordset... Say row 3... So you can have a repeat region of 3 on 1 part of the page and continue with the next 3 on a different part of the page?
I would like to have 5 repeat regions with say 3 records each on a page using 1 recordset and have each next repeat region start of where it left off at the other 1...
Is that possible with this method?
wkr
mustang_sally_85344510
07-27-2010, 07:05 AM
I would consider binding the information to the specific row you want the information and from whatever recordset.
I've combined information from different recordsets and applied a repeat region to it and haven't had any issues so far. :)
vBulletin® v3.8.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.