mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-04 06:30:57 +00:00
Encourage using prepared statements
This commit is contained in:
committed by
Fabien Potencier
parent
ea371bee81
commit
97d9dc0404
+2
-2
@@ -409,8 +409,8 @@ First, let's create a temporary in-memory SQLite3 database to work with::
|
||||
{% block content %}Hello {{ name }}{% endblock %}
|
||||
';
|
||||
$now = time();
|
||||
$dbh->exec("INSERT INTO templates (name, source, last_modified) VALUES ('base.twig', '$base', $now)");
|
||||
$dbh->exec("INSERT INTO templates (name, source, last_modified) VALUES ('index.twig', '$index', $now)");
|
||||
$dbh->prepare('INSERT INTO templates (name, source, last_modified) VALUES (?, ?, ?)')->execute(['base.twig', $base, $now]);
|
||||
$dbh->prepare('INSERT INTO templates (name, source, last_modified) VALUES (?, ?, ?)')->execute(['index.twig', $index, $now]);
|
||||
|
||||
We have created a simple ``templates`` table that hosts two templates:
|
||||
``base.twig`` and ``index.twig``.
|
||||
|
||||
Reference in New Issue
Block a user