Database Queries

A few basic examples of IPB built in database class.

IPB 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
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'db_table' ) ); $this->ipsclass->DB->simple_exec();
$r = $this->ipsclass->DB->fetch_row();


Database Insert
$this->ipsclass->DB->do_insert( 'db_table', array ( 'row1' => "row1", 'row2' => "row2", 'row3' => "row3", ) );


Database Delete
$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'db_table', 'where' => 'id=1' ) );


You can also add different code to your query, including where, order and limit.
Where
'where' => 'id=1'

Order
'order' => 'date DESC'

Limit
'limit' => array(0,1)

AddThis Social Bookmark Button AddThis Feed Button