Jump to content

  • twitter
  • youtube
  • googleplus
  • facebook
  • rss
  • newsletter


Tutorial info Visit support topic

  • Added on: Jan 08 2009 06:24 PM
  • Views: 2118
 


[IPB 2.3.x] Database Queries

A few basic examples of IPB built in database class.

Posted by Michael on Jan 08 2009 06:24 PM
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

$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)

Powered by Tutorials 1.4.1 © 2012, by Michael McCune