[SOLVED] yet another problem for the newbee

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
groovster
Forum Newbie
Posts: 10
Joined: Sun Nov 21, 2004 1:56 pm
Location: Uppsala, Sweden

[SOLVED] yet another problem for the newbee

Post by groovster »

Hi again!

Well I'm new into PHP and MYSQL, sp i have ran into a new problem.
please please help me.

I have this address book database. In this database i have seperated the contacts into countries.
I want to be able to create a link for each country and the after that to be able to see the contacts.
I'm able to pull the contacts the from the databse.
But when i try to get the links with the countries i get like a 20 links with the same country. How do i limit that to only 1 link for each country.

tHX.

NewBee (Groovster)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

DISTINCT or GROUP BY
groovster
Forum Newbie
Posts: 10
Joined: Sun Nov 21, 2004 1:56 pm
Location: Uppsala, Sweden

group i think

Post by groovster »

My table look like this:

Country Sweden
Name Johan
Lastname Killing
Phone Storgatan 43
and so on....

On the first page i would like to have that it looks like this but i want the script to get the name of the country. For example:


Your conatcts in:

Sweden
USA
Canada


Do you understand what i mean?
i belive it is by group, right?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

ability to use either depends a bit on the rest of the query. Group-by is often easier to set up in a usable.
groovster
Forum Newbie
Posts: 10
Joined: Sun Nov 21, 2004 1:56 pm
Location: Uppsala, Sweden

Good

Post by groovster »

Thanks.

You are good dude! :lol:

I'll get back if I see problems.

Once again, thank you!

Regards,
Groovster
Post Reply