pdo bindparam string 1

pdo bindparam string

prepare('SELECT name, colour, calories
    FROM fruit
    WHERE calories < :calories AND colour = :colour');
$sth->bindParam(':calories', $calories, PDO::PARAM_INT);
$sth->bindParam(':colour', $colour, PDO::PARAM_STR, 12);
$sth->execute();
?>

Here is what the above code is Doing:
1. The prepare() method of the PDO object is used to prepare the SQL statement.
2. The bindParam() method binds the named parameter markers to the specified PHP variables.
3. The execute() method of the PDOStatement object executes the prepared statement.

Similar Posts