Hi,

I would made it with a url parameter:

$skin = $wgUser->getSkin();
$table = 'mytable';
$id = 0;
$wgOut->addHtml( $skin->link( $this->getTitle(), wfMsg('mymessage'),
array(), array( 'action' => 'delete', 'table' => $table, 'id' => $id ) ) );

...

$action = htmlentities( $wgRequest->getText( 'action' ) );
$table = htmlentities( $wgRequest->getText( 'table' ) );
$id = htmlentities( $wgRequest->getText( 'id' ) );

if( $action == 'delete' AND ( $table == 'mytable' ) ) $this->delete( $table,
$id );

...

private function delete( $table, $id ) {
    $dbw = wfGetDB( DB_MASTER );
    $dbw->delete( $table, array( 'id' => $id ) );
}

Viele Grüße
Jan

-----Ursprüngliche Nachricht-----
Von: mediawiki-l-boun...@lists.wikimedia.org
[mailto:mediawiki-l-boun...@lists.wikimedia.org] Im Auftrag von Eric K
Gesendet: Freitag, 28. August 2009 14:08
An: mediawiki-l@lists.wikimedia.org
Betreff: [Mediawiki-l] Special Page: Executing SQL query with a browser
click

(sending again, my last message didnt appear in the list)
-------------------
In my own special page, I've made a custom query (e.g., DELETE * from
table).
I want to display an HTML link, which when clicked by the user viewing that
page executes that SQL query. How can I do that?
 
 


      
_______________________________________________
MediaWiki-l mailing list
MediaWiki-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l


_______________________________________________
MediaWiki-l mailing list
MediaWiki-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l

Reply via email to