Jump to content
DevFuse Forums

[IPB 2.3.x] Database Queries


A few basic examples of IPB built in database class.
IP.Board 2.3.x comes with a built in database class use under the new ipsclass. This will perform just about any database query you may have. Below are some of the basics.

Database Select

[code]$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'db_table' ) ); $this->ipsclass->DB->simple_exec();
$r = $this->ipsclass->DB->fetch_row();[/code]

Database Insert

[code]$this->ipsclass->DB->do_insert( 'db_table', array ( 'row1' => "row1", 'row2' => "row2", 'row3' => "row3", ) );[/code]

Database Delete

[code]$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'db_table', 'where' => 'id=1' ) );[/code]

You can also add different code to your query, including where, order and limit.

[code]'where' => 'id=1'[/code]


[code]'order' => 'date DESC'[/code]


[code]'limit' => array(0,1)[/code]

Recommended Comments

There are no comments to display.

  • Create New...