// Include Propel's runtime library require_once 'vendor/autoload.php'; use Propel\Runtime\Propel; // Set the connection parameters $connectionParams = [ 'dsn' => 'mysql:host=localhost;dbname=mydatabase', 'user' => 'myusername', 'password' => 'mypassword', 'options' => [] ]; // Configure Propel with the connection parameters Propel::init($connectionParams); // Retrieve a database connection $conn = Propel::getConnection(); // Use the connection to execute a query $stmt = $conn->prepare('SELECT * FROM mytable'); $stmt->execute();
// Include Propel's runtime library require_once 'vendor/autoload.php'; use Propel\Runtime\Propel; // Load the database configuration from an external file $config = require_once 'config/database.php'; // Configure Propel with the database configuration Propel::init($config); // Retrieve a database connection $conn = Propel::getConnection(); // Use the connection to execute a query $stmt = $conn->prepare('SELECT * FROM mytable WHERE id = ?'); $stmt->bindValue(1, 123, PDO::PARAM_INT); $stmt->execute();Package library: Propel\Runtime