Welcome to WebmasterWorld Guest from 54.226.241.8

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

PEAR - How to extract results from MDB2 join query?

     

stivare

1:08 am on Jun 29, 2009 (gmt 0)

5+ Year Member



Hi,

Has anyone on this site used PEAR-MDB2 package to perform join queries and tried to extract the results? I can create the join queries and they get executed fine. I can extract columns of the current table (sections table in the following example) from the results but not the info from the joined tables (rows and cells). Or do I need to learn Doctrine also just to execute the join queries?

Any help is greatly appreciated. Sad part is there is no documentation available.

Thanks
Su Ti
------------------------------------
SELECT sections.sectionid, cells.* FROM sections
INNER JOIN rows ON sections.sectionid=rows.sectionid
INNER JOIN cells ON rows.rowid=cells.rowid

CREATE TABLE IF NOT EXISTS `sections` (
`SectionId` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`SectionName` varchar(10) NOT NULL,
PRIMARY KEY (`SectionId`),
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;

CREATE TABLE IF NOT EXISTS `rows` (
`RowId` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`RowName` varchar(10) NOT NULL,
`SectionId` mediumint(8) unsigned NOT NULL,
PRIMARY KEY (`RowId`),
KEY `SectionsRows` (`SectionId`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;
CREATE TABLE IF NOT EXISTS `cells` (
`CellId` int(10) unsigned NOT NULL AUTO_INCREMENT,
`RowId` mediumint(8) unsigned NOT NULL,
`CellName` varchar(5) NOT NULL,
PRIMARY KEY (`CellId`),
KEY `RowsCells` (`RowId`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;

stivare

5:18 pm on Jul 1, 2009 (gmt 0)

5+ Year Member



Ok Never mind.... I just implemented my own class to take care of it.

Thanks
Sudheer

 

Featured Threads

Hot Threads This Week

Hot Threads This Month