2009/8/15 Kathleen Borja <[email protected]>:
> I've sent you an email ([email protected]). I hope I've got the right 
> email.
>
> I was able to connect to the database using the wfGetDb statement. I now use 
> the
> $dbr object to access the fields and values in the database. I used the 
> select()
> method. I'm learning on how to use the especially the insert() method for it
> will now use the write method. Can you give me an example of the insert()?
>
You'll need a write connection to be able to insert:

$dbw = wfGetDb( DB_MASTER ); // As opposed to DB_SLAVE, which is read-only

// Insert one row:
$dbw->insert( 'tablename', array( 'field1' => 'value1', 'field2' =>
'value2' ), __METHOD__ );

// Insert two rows and ignore errors such as duplicate indexes
$dbw->insert( 'tablename', array( array( 'field1' => 'value1',
'field2' => 'value2' ), array( 'field1' => 'value3', 'field2' =>
'value4' ) ), __METHOD__, array( 'IGNORE' ) );

Documentation for insert() and other $dbr/$dbw methods is at
http://svn.wikimedia.org/doc/classDatabaseBase.html#e620764adec943ea9b52d0551a361a61
. You may also be interested in update() and replace().

> Now, I made Special Page. But, when a link in a special page is clicked, it 
> must
> redirect to another page. But what I did is I made another special page for it
> to redirect to. Is there an easy way to make a page having the special page
> template?
>
What do you mean redirect to another page? Do you just want a simple
link to another page, or do you want something more complex?

Roan Kattouw (Catrope)

_______________________________________________
Mediawiki-api mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api

Reply via email to