Skip to Content
Mastering PHP 7
book

Mastering PHP 7

by Branko Ajzele
June 2017
Intermediate to advanced
536 pages
9h 49m
English
Packt Publishing
Content preview from Mastering PHP 7

Updating 

Much like selecting and inserting, we can also use the prepare(), bind_param(), and execute() methods to handle record updating, as follows:

<?phptry {    // Report on all types of errors    mysqli_report(MYSQLI_REPORT_ALL);    // Open a new connection to the MySQL server    $mysqli = new mysqli('127.0.0.1', 'root', 'mL08e!Tq', 'sakila');    // Prepare some teat address data    $address = 'The new street';    $addressId = 600;    // Prepare an SQL statement for execution    $statement = $mysqli->prepare('UPDATE address SET address = ? WHERE address_id = ?');    // Bind variables to a prepared statement as parameters    $statement->bind_param('si', $address, $addressId);    // Execute a prepared Query    $statement->execute();    // Close a prepared statement    $statement ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning PHP 7

Learning PHP 7

Antonio L Zapata (GBP)
Upgrading to PHP 5

Upgrading to PHP 5

Adam Trachtenberg

Publisher Resources

ISBN: 9781785882814Supplemental Content