Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 554
  • Last Modified:

Duplicate results using Dreamweaver Repeat Region

I am using Dreamweaver to create a dynamic application.  I have entered some sample data into my database and verified that it is only entered once.  I have used Dreamweaver to setup a Repeat Region.  When i test the application, it returns duplicate results, (i.e. record 1, record 2, <BR>record 1, record 2).

I have checked over the code and don't see anything that should be causing this problem.  Any Advice?
0
axessJosh
Asked:
axessJosh
  • 4
  • 4
1 Solution
 
Jason C. LevineNo oneCommented:
Hi axessJosh,

>> I have checked over the code and don't see anything that should be causing this problem.  Any Advice?

Yes. Let us check your code.
0
 
axessJoshAuthor Commented:
actually, after further review, the results are showing:

name 1 - result 1
name 1 - result 2
name 2 - result 1(repeat)
name 1 - result 2(repeat)

name is pulled from a separate table than the results.
0
 
axessJoshAuthor Commented:
Here is my DB setup.

users table - ID, name, PW
payees table - ID, name, address, city, state, Zip, acct
bills table - ID, users.ID(foreign), payees.ID(foreign), date submitted, amount, expense line


$colname_rsUsers = "-1";
if (isset($_GET['ID'])) {
  $colname_rsUsers = $_GET['ID'];
}
mysql_select_db($database_conClient, $conClient);
$query_rsUsers = sprintf("SELECT ID, name FROM users WHERE ID = %s", GetSQLValueString($colname_rsUsers, "int"));
$rsUsers = mysql_query($query_rsUsers, $conClient) or die(mysql_error());
$row_rsUsers = mysql_fetch_assoc($rsUsers);
$totalRows_rsUsers = mysql_num_rows($rsUsers);
 
$colname_rsBills = "-1";
if (isset($_GET['ID'])) {
  $colname_rsBills = $_GET['ID'];
}
mysql_select_db($database_conClient, $conClient);
$query_rsBills = sprintf("SELECT UsersID, payeesID, `Date`, Amount, payees.name FROM bills, payees WHERE UsersID = %s", GetSQLValueString($colname_rsBills, "int"));
$rsBills = mysql_query($query_rsBills, $conClient) or die(mysql_error());
$row_rsBills = mysql_fetch_assoc($rsBills);
$totalRows_rsBills = mysql_num_rows($rsBills);
?>
 
//normal head data //
 
<div id="bills">
  <h2>Your Existing Bills</h2>
   <?php do { ?>
     <?php echo $row_rsBills['name']; ?> - $<?php echo $row_rsBills['Amount']; ?> - <?php echo $row_rsBills['Date']; ?><br />
     <?php } while ($row_rsBills = mysql_fetch_assoc($rsBills)); ?>
 
    <a href="addBill.php">Add New Bill</a>
</div>

Open in new window

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Jason C. LevineNo oneCommented:
Okay, then that behavior is "normal"

If you are pulling from two tables at once with a one-to-many relationship, the master row will repeat so long at the child rows match.

What you need to do is create a nested repeating region that limits the iteration of the master row while the child repeats.  Tom Muck has written an extension for you:

http://www.tom-muck.com/extensions/help/simulatednestedregion/
0
 
axessJoshAuthor Commented:
I downloaded the extension, restarted Dreamweaver.  How do i apply the extension once i have highlighted the text?
0
 
Jason C. LevineNo oneCommented:
Go back to the page linked above.  Instructions are there.
0
 
axessJoshAuthor Commented:
Oops, figured it out.

that worked for the name field, however, now it displays

name1 - record 1
- record 2
name 2 - record 1
- record 2
0
 
Jason C. LevineNo oneCommented:
You'll have to play around with how you are returning the data to get it to work the way you want.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now