Link to home
Start Free TrialLog in
Avatar of axessJosh
axessJosh

asked on

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?
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

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.
Avatar of axessJosh
axessJosh

ASKER

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.
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

ASKER CERTIFIED SOLUTION
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I downloaded the extension, restarted Dreamweaver.  How do i apply the extension once i have highlighted the text?
Go back to the page linked above.  Instructions are there.
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
You'll have to play around with how you are returning the data to get it to work the way you want.