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=>[email protected]

2=>parent1

 

1 =>

0=>name2

1=>[email protected]

2=>parent1

parent2 = >

0 =>

0=>name3

1=>[email protected]

2=>parent2

 

1 =>

0=>name4

1=>[email protected]

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','[email protected]','parent1'),(2,'name2','[email protected]','parent1'),(3,'name3','[email protected]','parent2'),(4,'name4','[email protected]','parent2');

Link to comment
https://forums.phpfreaks.com/topic/266069-create-array-from-result-set/
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.