Jump to content

[SOLVED] UNIQE ARRAY


crashmaster

Recommended Posts

Hi there,

I have one problem/

 

ex. of mysql database 'test'

-----------------

id: 1 , name:Admin

id: 2 , name: user1

id: 3 , name: Admin

id: 4 , name: user2

id: 5 , name: user1

-----------------

 

ex. of the mysql_qery

$query = mysql_query("SELECT name FROM test");

 

What I need:

I need to create array $names, where each 'name' will be only once.

 

I've tried this, but it doesnt work

while ( $z = array_unique(mysql_fetch_array($query)) ) { 
echo $z[name];
}

 

I need to have output like this:

$names = array ('Admin', 'user1', 'user2');

 

 

Can somebody help me...

 

 

Link to comment
https://forums.phpfreaks.com/topic/77833-solved-uniqe-array/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.