Wpis z mikrobloga

@Krathac:

caly kod:

$pdo = new PDO('sqlite:users.db');
$stmt = $pdo->prepare('SELECT name FROM users WHERE id = :id');
$stmt->bindParam(':id', $_GET['id'], PDO::PARAM_INT); //<-- Automatyczne zabezpieczenie wartości parametru
$stmt->execute();

Po prostu nie rozumiem wlasnie tego stmt, do czego jest ona napisana, co robi itp. Pierwszej lini:

$pdo = new PDO('sqlite:users.db');

tez troche nie rozumiem. To tworzy "users.db plik czy tabele ?"
@blakker: Opisy klas metod tłumaczą bardzo dobrze.

Mniej więcej po kolei odnosząc do Twojego kodu, to w dokumentacji masz:

PDO class - Represents a connection between PHP and a database server.
PDO::prepare — Prepares a statement for execution and returns a statement object
PDOStatement class - Represents a prepared statement and, after the statement is executed, an associated result set.
PDOStatement::bindParam — Binds a parameter to the specified variable name
PDOStatement::execute