Nvm - just found what I needed.
Regards, Aretai
On 3/22/07, aretai aretai aretaiuc@gmail.com wrote:
Hi,
As there is not much info on wfGetDB() on http://meta.wikimedia.org/wiki/Writing_a_new_special_page#wfGetDB.28.29 maybe someone could help me with my problem:
I use MW 1.6.7. (MySQL 4) (Yes I know it won't be supported soon so for now just assume I use any version that is supported;)). I try to get the list of the pages with a given text so I use a query like:
SELECT page_title FROM page, revision, text WHERE old_text LIKE '%test%' AND page_latest = rev_id AND rev_text_id = old_id;
To get results for search string Text. It works when I use it within MySQL environment. However there are some problems with pulling it to Wiki. To have "SELECT page_title FROM page" I used:
$dbr =& wfGetDB( DB_SLAVE ); $res = $dbr->select( 'page', array('page_title') ); $wgOut->addHTML ("<table>"); $wgOut->addHTML ("<tr><th>Page Title</th>"); while ( $row = $dbr->fetchObject( $res ) ) { $wgOut->addHTML ("<tr><td>" . $row->page_title"</td>"); } $dbr->freeResult( $res );
However I'm not sure how to handle more advance queries. thx in advance for help
Regards, Aretai