Version 1/6 - Next » - Current version
wesen 3000, 2011-08-15 02:31 AM


SQLBuilder

This guide will show you how to use the php-activerecord SQL builder.

The first steps are to get the database connection and setup the SQL builder.

1 $cfg = ActiveRecord\Config::instance();                                                                                                                              
2 $conn = $cfg->get_connection("development");                                                                                                                         
3 $builder = new ActiveRecord\SQLBuilder($conn, "authors"); 
4 
5 $builder->where("name = ?", "Hemingway");
6 echo $builder; /* => SELECT * FROM authors WHERE name = ? */
7 print_r($builder->get_where_values()); /* => array("Hemingway") */
8 </class>

Also available in: HTML TXT