Solved

MYSQL result set seems to be multiplied by 6

Posted on 2013-06-26
2
368 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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

708 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

18 Experts available now in Live!

Get 1:1 Help Now