$con = Propel::getConnection(); $stmt = $con->prepare('SELECT * FROM customers'); $stmt->execute(); $results = $stmt->fetchAll(PDO::FETCH_ASSOC);
$config = array( 'dsn' => 'mysql:host=localhost;dbname=test', 'user' => 'username', 'password' => 'password' ); $con = Propel::getConnection($config); $stmt = $con->prepare('INSERT INTO customers (name, email) VALUES (?, ?)'); $stmt->execute(array('John Doe', 'john@example.com'));In this example, the getConnection method is called with a configuration array that defines the database name, username, and password. The PDO object is then used to insert a new record into the customers table. Propel is a package library for PHP that provides an Object Relational Mapping (ORM) system. It allows developers to work with databases using familiar object-oriented syntax, rather than writing SQL statements directly.