PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Sat Jul 04, 2020 1:14 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Fri Feb 10, 2006 4:30 pm 
Offline
Forum Commoner

Joined: Fri May 13, 2005 2:36 pm
Posts: 32
Location: phoenix
this is a rather simple question, so i hope there is a simple answer...

is there any way to have mysql_fetch_array output only 1 of many similar entries in the database?

for example, if these were entries in my database:

a
b
a
b
b
c
c
c

the output would be:

a
b
c

Thanks for any help.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 10, 2006 4:34 pm 
Offline
Forum Contributor

Joined: Tue Dec 06, 2005 6:34 pm
Posts: 258
Location: W-Town


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 10, 2006 4:41 pm 
Offline
Forum Commoner

Joined: Fri May 13, 2005 2:36 pm
Posts: 32
Location: phoenix


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 10, 2006 10:53 pm 
Offline
DevNet Master
User avatar

Joined: Mon Oct 25, 2004 9:29 pm
Posts: 3698
Location: New Jersey, US
I wonder why he would need this though... it's generally good practice to assign a non-meaningful id to all entries in databases.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 11, 2006 7:06 am 
Offline
Site Administrator
User avatar

Joined: Sun May 19, 2002 10:24 pm
Posts: 6887

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 11, 2006 10:29 am 
Offline
Neighborhood Spidermoddy
User avatar

Joined: Mon Mar 29, 2004 4:24 pm
Posts: 31559
Location: Bothell, Washington, USA
using group by or distinct will generally do the job, however using both can be overkill.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 29 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group