Solved

MYSQL result set seems to be multiplied by 6

Posted on 2013-06-26
2
371 Views
Last Modified: 2013-06-26
I have a result set that is displaying information, but is taking my DB content and showing each result 6 times.

I'm sure I'm overlooking something simple.

if(isset($_GET['refID'])) {
	$refID = $_GET['refID'];
	$queryDet = "SELECT tbldeposit.depDate, tbldeposit.depAmnt, tbldeposit.depDesAcct, tbldeposit.depMemo, tbldeposit.depTender, tbldeposit.depLineID, tbldeposit.depBnkID, tbldeposit.depClientID, tbldeposit.depFundSrc FROM tbldeposit, tbldeposittotals WHERE tbldeposit.depLineID = '$refID'";
	$detResult = mysql_query($queryDet) or die(mysql_error());
	
		while ($rowDet = mysql_fetch_assoc($detResult)) {
		$detID = $rowDet['depAmnt'];
		$detRef = $rowDet['depLineID']; 
		
		echo $detID . " " . $detRef . "<br />"; 
	}
}

Open in new window

0
Comment
Question by:axessJosh
2 Comments
 
LVL 40

Accepted Solution

by:
Sharath earned 260 total points
ID: 39279499
Why do you want to join with tbldeposittotals when you are not selecting any data from this table? Also I did not see any JOIN condition between bldeposit, tbldeposittotals tables.
Try this query and see if it is giving duplicates.
if(isset($_GET['refID'])) {
	$refID = $_GET['refID'];
	$queryDet = "SELECT tbldeposit.depDate, tbldeposit.depAmnt, tbldeposit.depDesAcct, tbldeposit.depMemo, tbldeposit.depTender, tbldeposit.depLineID, tbldeposit.depBnkID, tbldeposit.depClientID, tbldeposit.depFundSrc FROM tbldeposit WHERE tbldeposit.depLineID = '$refID'";
	$detResult = mysql_query($queryDet) or die(mysql_error());
	
		while ($rowDet = mysql_fetch_assoc($detResult)) {
		$detID = $rowDet['depAmnt'];
		$detRef = $rowDet['depLineID']; 
		
		echo $detID . " " . $detRef . "<br />"; 
	}
}

Open in new window

0
 
LVL 2

Author Closing Comment

by:axessJosh
ID: 39279505
forgot to remove that second table join when I updated the statement.  Thanks.
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

863 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

21 Experts available now in Live!

Get 1:1 Help Now