[Solved] Parameterized SELECT queries via PDO? [duplicate]


The PHP Manual has some good examples.

For you:

function user_login($username, $password) {
    $conn = connection_getConnection();

    $sql = "SELECT `password` FROM `users` WHERE `username` = :username";
    $stmt = $conn->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
    $query = $stmt->execute(array(':username' => $username));
    $rows = $query->fetchAll();
    if (empty($rows)) {

    }
}

5

solved Parameterized SELECT queries via PDO? [duplicate]