1 2 3 4 5 | $sex = 'male';$s = $dbh->prepare('SELECT name FROM students WHERE sex = :sex');$s->bindParam(':sex', $sex); // use bindParam to bind the variable$sex = 'female';$s->execute(); // executed with WHERE sex = 'female' |
1 2 3 4 5 | $sex = 'male';$s = $dbh->prepare('SELECT name FROM students WHERE sex = :sex');$s->bindValue(':sex', $sex); // use bindValue to bind the variable's value$sex = 'female';$s->execute(); // executed with WHERE sex = 'male' |
'Programming > PHP' 카테고리의 다른 글
| PDO (0) | 2016.06.30 |
|---|---|
| Namespace (0) | 2016.06.30 |