homepage Welcome to WebmasterWorld Guest from 54.163.91.250
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
PEAR - How to extract results from MDB2 join query?
stivare




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

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




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

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

Thanks
Sudheer

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved