# Prepared Statement and `PDO_MySQL`
+ **`PREPARE`** phase:
  + Create the SQL statement with named placeholders or question marks to represent the values that will change with each execution, for example we are using named placeholders here:
    + **`$sqlStmt = "INSERT INTO pdo_t1 (c1, c2)" . " VALUES (:c1_value, :c2_value)"`**
  + Create a prepared statement object from the `PDO` object:
    + **`$stmt = $dbHandle->prepare($sqlStmt)`**
  + Bind variables that contain the values for the named placeholders, for this example:
    + **`$stmt->bindParam(':c1_value',$v1)`**
    + **`$stmt->bindParam(':c2_value',$v2)`**
+ **`EXECUTE`** phase:
  + Assign values to bind variables, for this example:
    + **`$v1 = "V1"`**
    + **`$v2 = "V2"`**
  + Call method **`$stmt->execute()`** to execute
-----------------------------------------------------------------------------------
To create a prepared statement in `PHP/PDO`, write the SQL using placeholders or question marks for the values that will change with each execution. 

The example in the slide uses named placeholders to do this instead of question marks. This method is preferred because it makes your code easier to read. 

When you have prepared a statement, get it ready for execution by setting values for each placeholder using the `bindParam()` method. 

Execute a prepared statement by using the statement object’s `execute()` method, regardless of whether the statement is a query that returns rows or not.

After executing the statement and reading its returned values, assign new values to the placeholders and re-execute the prepared statement without preparing it again. When you are finished with the prepared statement, close it with `$stmt->closeCurosr()`.
