Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > MySQL
|
MySQL General discussion about the MySQL database.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the MySQL section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 18th, 2007, 02:03 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

SELECT DISTINCT works like this:

Consider that the following information is rows in a table
May City1 State1 Location
May City1 State1 Location

A select distinct will return just one of the above rows since they are identical but
May City1 State1 Location
May City2 State1 Location

A select distinct here will return both rows because the rows are not identical albeit just the city is different.

Now, in both cases, say I do SELECT DISTINCT name from TABLE this will return 1 row all the time regardless of the data in other columns. (It should just return 1 instance of 'May')

It sounds like A)You have a problem with your query or B)Your loop is repeating itself. What I might suggest is executing the query directly in MySQL (not through PHP code) and see if you have just 4 rows returned, if you do your loop is messed up, if the query returns 6 rows then there is a problem with the query.

================================================== =========
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
================================================== =========
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile
================================================== =========
 
Old January 18th, 2007, 04:58 PM
Authorized User
 
Join Date: Nov 2006
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to mark jonas
Default

ok cheers for that i will have a look into it tomorrow as work has got a bit busy

thanks for your help and ill let you no how i get on

cheers
mark

 
Old January 19th, 2007, 09:59 AM
Authorized User
 
Join Date: Nov 2006
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to mark jonas
Default

so you no i have this working to the needs i need and have worked out why it was looping thatnks aagain for you time


cheers
mark

 
Old January 19th, 2007, 10:01 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Glad it worked out for you ^^

================================================== =========
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
Searching through a database d5t ASP.NET 1.0 and 1.1 Basics 6 October 27th, 2006 07:10 AM
help with Database searching europhreak Classic ASP Basics 1 February 8th, 2006 07:30 AM
Searching the database...HELP! Zedman BOOK: Beginning ASP 3.0 6 September 30th, 2004 09:52 AM
Searching trough a database toni_montana PHP How-To 2 September 25th, 2004 09:17 AM
searching a database shabazzk Classic ASP Databases 2 March 10th, 2004 06:56 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.