<?php
 
// includes the file that contains data for connecting to mysql database, and  PDO_MySQLi class
 
include('../conn_mysql.php');
 
 
// creates object with connection to MySQL
 
$conn = new PDO_MySQLi($mysql);
 
 
// UPDATE with placeholder question marks in the SQL statement,
 
// and values into an numerical array (in the same order as question marks), numerical index starting from 0
 
$sql = "UPDATE `testclass` SET `url` = ?, `title` = ? WHERE `id` = ?";
 
$vals = array('http://marplo.net/', 'Free Courses', 3);
 
 
// executes the SQL query, passing the SQL query and the array with values
 
$resql = $conn->sqlExecute($sql, $vals);
 
 
// check if the SQL query succesfully performed, displays the number of affected rows
 
if($resql) echo 'Updated succesfully '. $conn->affected_rows .' row';
 
else echo $conn->error;
 
 |