Jump to content

create array from result set.


zohab

Recommended Posts

Hi,

 

I want to create result set from group by column.

 

I have parent_title as group by columns

 

I want to create array something like

 

parent1 = >

0 =>

0=>name1

1=>name1@email.com

2=>parent1

 

1 =>

0=>name2

1=>name2@email.com

2=>parent1

parent2 = >

0 =>

0=>name3

1=>name3@email.com

2=>parent2

 

1 =>

0=>name4

1=>name4@email.com

2=>parent2

 

Thanks

Zohaib.

 

DROP TABLE IF EXISTS `tablename`;

CREATE TABLE `tablename` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(300) DEFAULT NULL,
  `email` varchar(300) DEFAULT NULL,
  `parent_title` varchar(300) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;

/*Data for the table `tablename` */

insert  into `tablename`(`id`,`name`,`email`,`parent_title`) values (1,'name1','name1@email.com','parent1'),(2,'name2','name2@email.com','parent1'),(3,'name3','name3@email.com','parent2'),(4,'name4','name4@email.com','parent2');

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.