Solved

Duplicate results using Dreamweaver Repeat Region

Posted on 2009-04-08
8
541 Views
Last Modified: 2013-12-13
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
Comment
Question by:axessJosh
  • 4
  • 4
8 Comments
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 24099509
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
 
LVL 2

Author Comment

by:axessJosh
ID: 24099516
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
 
LVL 2

Author Comment

by:axessJosh
ID: 24099546
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
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 125 total points
ID: 24099548
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 2

Author Comment

by:axessJosh
ID: 24099625
I downloaded the extension, restarted Dreamweaver.  How do i apply the extension once i have highlighted the text?
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 24099656
Go back to the page linked above.  Instructions are there.
0
 
LVL 2

Author Comment

by:axessJosh
ID: 24099660
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
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 24099891
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now