{"id":1321,"date":"2021-04-22T04:10:30","date_gmt":"2021-04-22T04:10:30","guid":{"rendered":"https:\/\/phptutorial.net\/?page_id=1321"},"modified":"2021-07-08T04:14:30","modified_gmt":"2021-07-08T04:14:30","slug":"php-prepared-statement","status":"publish","type":"page","link":"https:\/\/www.phptutorial.net\/php-pdo\/php-prepared-statement\/","title":{"rendered":"PHP Prepared Statement"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you will learn about the PHP prepared statements in PDO and how to use them effectively.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='introduction-to-php-prepared-statements'>Introduction to PHP prepared statements <a href=\"#introduction-to-php-prepared-statements\" class=\"anchor\" id=\"introduction-to-php-prepared-statements\" title=\"Anchor for Introduction to PHP prepared statements\">#<\/a><\/h2>\n\n\n\n<p>A prepared statement is a template for executing one or more SQL statements with different values. A prepared statement is highly efficient and helps protect the application against SQL injections.<\/p>\n\n\n\n<p>When a database server executes a query, it goes through two main stages: preparation and execution.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Preparation &#8211; the database server checks the syntax of the SQL statement and initializes internal server resources for the execution stage.<\/li><li>Execution &#8211; the application binds the values and sends the SQL statement to the database server. The database server executes the statement with the bound values using the internal server resource allocated in the preparation stage.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id='constructing-a-prepared-statement-in-pdo'>Constructing a prepared statement in PDO <a href=\"#constructing-a-prepared-statement-in-pdo\" class=\"anchor\" id=\"constructing-a-prepared-statement-in-pdo\" title=\"Anchor for Constructing a prepared statement in PDO\">#<\/a><\/h2>\n\n\n\n<p>To construct a prepared statement in PDO, you follow these steps:<\/p>\n\n\n\n<p>First, create a template SQL statement. For example:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">$sql = <span class=\"hljs-string\">'insert into authors(first_name, last_name)\n        values(?,?)'<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>This <code>INSERT<\/code> statement has two question marks (<code>?<\/code>). They are called positional placeholders. <\/p>\n\n\n\n<p>When executing the statement, you need to pass values to the placeholders by their positions. In other words, you need to pass the first name to the first placeholder and the last name to the second placeholder<\/p>\n\n\n\n<p>Second, call the <code>prepare()<\/code> method of a PDO instance:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">$statement = $pdo-&gt;prepare($sql);<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The <code>prepare()<\/code> method returns a new instance of the <code>PDOStatement<\/code> class.<\/p>\n\n\n\n<p>Third, call the <code>execute()<\/code> method and pass the values to the placeholders:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">$statement-&gt;execute(&#91;<span class=\"hljs-string\">'Sandra'<\/span>, <span class=\"hljs-string\">'Aamodt'<\/span>]);<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The <code>execute()<\/code> method will substitute the first placeholder by <code>'Sandra'<\/code> and the second one by <code>'Aamodt'<\/code> in the insert statement.<\/p>\n\n\n\n<p>Put it all together.<\/p>\n\n\n\n<p>The following shows how to use the prepared statement to insert a new row into the <code>authors<\/code> table:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml\"><span class=\"php\"><span class=\"hljs-meta\">&lt;?php<\/span>\n\n$pdo = <span class=\"hljs-keyword\">require<\/span> <span class=\"hljs-string\">'connect.php'<\/span>;\n\n$sql = <span class=\"hljs-string\">'insert into authors(first_name, last_name)\n        values(?,?)'<\/span>;\n\n$statement = $pdo-&gt;prepare($sql);\n\n$statement-&gt;execute(&#91;<span class=\"hljs-string\">'Sandra'<\/span>, <span class=\"hljs-string\">'Aamodt'<\/span>]);<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"note\">Note that the script reuses the <code>connect.php<\/code> file that <a href=\"https:\/\/phptutorial.net\/php-pdo\/php-pdo-mysql\/\">connects to <code>bookdb<\/code> database and returns a new instance of the PDO class.<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='using-named-placeholders'>Using named placeholders <a href=\"#using-named-placeholders\" class=\"anchor\" id=\"using-named-placeholders\" title=\"Anchor for Using named placeholders\">#<\/a><\/h2>\n\n\n\n<p>When you use the positional placeholders in an SQL statement, you need to pass values that correspond to the positions of the placeholders. <\/p>\n\n\n\n<p>If an SQL statement has many placeholders, it&#8217;s quite easy to use the wrong positions. To avoid this, you can use the named placeholders instead. For example:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">$sql = <span class=\"hljs-string\">'insert into authors(first_name, last_name)\n        values(:first_name,:last_name)'<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this example, instead of using the question marks (<code>?<\/code>), you use the parameter name prefixed by a colon (<code>:<\/code>).  The colon is required in the SQL statement.<\/p>\n\n\n\n<p>When executing the statement, you need to pass an associative array to the <code>execute()<\/code> method like this:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">$statement-&gt;execute(&#91;\n\t<span class=\"hljs-string\">'first_name'<\/span> =&gt; <span class=\"hljs-string\">'Henry'<\/span>,\n\t<span class=\"hljs-string\">'last_name'<\/span> =&gt; <span class=\"hljs-string\">'Aaron'<\/span>\n]);<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Note that the key of the array is important, not the order of elements. Also, you can optionally use the <code>:<\/code> in the keys of the array:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">$statement-&gt;execute(&#91;\n\t<span class=\"hljs-string\">':first_name'<\/span> =&gt; <span class=\"hljs-string\">'Henry'<\/span>,\n\t<span class=\"hljs-string\">':last_name'<\/span> =&gt; <span class=\"hljs-string\">'Aaron'<\/span>\n]);<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The order of the array element is not important so you can use an array with elements in any order. For example:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">$statement-&gt;execute(&#91;\n\t<span class=\"hljs-string\">'last_name'<\/span> =&gt; <span class=\"hljs-string\">'Aaron'<\/span>,\n\t<span class=\"hljs-string\">'first_name'<\/span> =&gt; <span class=\"hljs-string\">'Henry'<\/span>,\n]);<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Put it all together.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml\"><span class=\"php\"><span class=\"hljs-meta\">&lt;?php<\/span>\n\n$pdo = <span class=\"hljs-keyword\">require<\/span> <span class=\"hljs-string\">'connect.php'<\/span>;\n\n$sql = <span class=\"hljs-string\">'insert into authors(first_name, last_name)\n        values(:first_name,:last_name)'<\/span>;\n\n$statement = $pdo-&gt;prepare($sql);\n\n$statement-&gt;execute(&#91;\n\t<span class=\"hljs-string\">'last_name'<\/span> =&gt; <span class=\"hljs-string\">'Aaron'<\/span>,\n\t<span class=\"hljs-string\">'first_name'<\/span> =&gt; <span class=\"hljs-string\">'Henry'<\/span>,\n]);<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id='bound-values'>Bound values <a href=\"#bound-values\" class=\"anchor\" id=\"bound-values\" title=\"Anchor for Bound values\">#<\/a><\/h2>\n\n\n\n<p>In the above examples, we pass the values to the <code>execute()<\/code> method to run the query. These statements are called <strong>unbound statements<\/strong>.<\/p>\n\n\n\n<p>Besides the unbound statements, PDO also supports <strong>bound statements<\/strong>. The bound statements allow you to explicitly bind a value or a variable to a named or positional placeholder.<\/p>\n\n\n\n<p>To bind a value, you use the <code>bindValue()<\/code> method of the <code>PDOStatement<\/code> object:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-10\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-keyword\">public<\/span> PDOStatement::bindValue ( mixed $parameter , mixed $value , int $data_type = PDO::PARAM_STR ) : bool<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-10\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The <code>bindValue()<\/code> method has three parameters:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><code>$parameter<\/code> specifies the parameter name <code>:parameter<\/code> if the statement uses the named placeholders or index of the parameter if the statement uses positional placeholders. In case you use the positional placeholder, the first parameter starts with the index 1.<\/li><li><code>$value<\/code> specifies the value to bind to the parameter.<\/li><li><code>$data_type<\/code> specifies the data type for the parameter using the <code>PDO::PARAM_*<\/code> e.g., <code>PDO::PARAM_INT<\/code>. By default, the <code>$data_type<\/code> is <code>PDO::PARAM_STR<\/code>.<\/li><\/ul>\n\n\n\n<p>The following example shows how to insert the author <code>Nick Abadzis<\/code> into the <code>authors<\/code> table using a bound statement:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-11\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml\"><span class=\"php\"><span class=\"hljs-meta\">&lt;?php<\/span>\n\n$pdo = <span class=\"hljs-keyword\">require<\/span> <span class=\"hljs-string\">'connect.php'<\/span>;\n\n$sql = <span class=\"hljs-string\">'insert into authors(first_name, last_name)\n        values(?,?)'<\/span>;\n\n$statement = $pdo-&gt;prepare($sql);\n\n$statement-&gt;bindValue(<span class=\"hljs-string\">':first_name'<\/span>, <span class=\"hljs-string\">'Nick'<\/span>);\n$statement-&gt;bindValue(<span class=\"hljs-string\">':last_name'<\/span>, <span class=\"hljs-string\">'Abadzis'<\/span>);\n\n$statement-&gt;execute();<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-11\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>When you use the <code>bindValue()<\/code> method, the <code>execute()<\/code> method executes the statement with the values passed to the <code>bindValue()<\/code> method, not the values at the time the <code>execute()<\/code> method runs. For example:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-12\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml\"><span class=\"php\"><span class=\"hljs-meta\">&lt;?php<\/span>\n\n$pdo = <span class=\"hljs-keyword\">require<\/span> <span class=\"hljs-string\">'connect.php'<\/span>;\n\n$sql = <span class=\"hljs-string\">'insert into authors(first_name, last_name)\n        values(:first_name,:last_name)'<\/span>;\n\n$statement = $pdo-&gt;prepare($sql);\n\n$author = &#91;\n\t<span class=\"hljs-string\">'first_name'<\/span> =&gt; <span class=\"hljs-string\">'Chris'<\/span>,\n\t<span class=\"hljs-string\">'last_name'<\/span> =&gt; <span class=\"hljs-string\">'Abani'<\/span>,\n];\n\n$statement-&gt;bindValue(<span class=\"hljs-string\">':first_name'<\/span>, $author&#91;<span class=\"hljs-string\">'first_name'<\/span>]);\n$statement-&gt;bindValue(<span class=\"hljs-string\">':last_name'<\/span>, $author&#91;<span class=\"hljs-string\">'last_name'<\/span>]);\n\n<span class=\"hljs-comment\">\/\/ change the author variable<\/span>\n$author&#91;<span class=\"hljs-string\">'first_name'<\/span>] = <span class=\"hljs-string\">'Tom'<\/span>;\n$author&#91;<span class=\"hljs-string\">'last_name'<\/span>] = <span class=\"hljs-string\">'Abate'<\/span>;\n\n<span class=\"hljs-comment\">\/\/ execute the query with value Chris Abani<\/span>\n$statement-&gt;execute();<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-12\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this example: <\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>First, bind the value <code>'Chris'<\/code> and <code>'Abate'<\/code> to the first name and last name parameters. <\/li><li>Second, change the values of the variable <code>$author<\/code>.<\/li><li>Third, execute the query. However, the <code>execute()<\/code> method uses the values passed to the <code>bindValue()<\/code> method, not the <code>$author<\/code> value at the time the <code>execute()<\/code> method runs.<\/li><\/ul>\n\n\n\n<p>This is why the <code>bindParam()<\/code> method comes into play.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='the-bindparam-method'>The bindParam() method <a href=\"#the-bindparam-method\" class=\"anchor\" id=\"the-bindparam-method\" title=\"Anchor for The bindParam() method\">#<\/a><\/h2>\n\n\n\n<p>To execute a statement whose values of the parameters are evaluated at the time the <code>execute()<\/code> method runs, you use the <code>bindParam()<\/code> method:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-13\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-keyword\">public<\/span> PDOStatement::bindParam ( mixed $parameter , mixed &amp;$variable , int $data_type = PDO::PARAM_STR , int $length = ? , mixed $driver_options = ? ) : bool<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-13\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The following example illustrates how to use the <code>bindParam()<\/code> method to insert a new author into the <code>authors<\/code> table:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-14\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml\"><span class=\"php\"><span class=\"hljs-meta\">&lt;?php<\/span>\n\n$pdo = <span class=\"hljs-keyword\">require<\/span> <span class=\"hljs-string\">'connect.php'<\/span>;\n\n$sql = <span class=\"hljs-string\">'insert into authors(first_name, last_name)\n        values(:first_name,:last_name)'<\/span>;\n\n$statement = $pdo-&gt;prepare($sql);\n\n$author = &#91;\n\t<span class=\"hljs-string\">'first_name'<\/span> =&gt; <span class=\"hljs-string\">'Chris'<\/span>,\n\t<span class=\"hljs-string\">'last_name'<\/span> =&gt; <span class=\"hljs-string\">'Abani'<\/span>,\n];\n\n$statement-&gt;bindParam(<span class=\"hljs-string\">':first_name'<\/span>, $author&#91;<span class=\"hljs-string\">'first_name'<\/span>]);\n$statement-&gt;bindParam(<span class=\"hljs-string\">':last_name'<\/span>, $author&#91;<span class=\"hljs-string\">'last_name'<\/span>]);\n\n<span class=\"hljs-comment\">\/\/ change the author variable<\/span>\n$author&#91;<span class=\"hljs-string\">'first_name'<\/span>] = <span class=\"hljs-string\">'Tom'<\/span>;\n$author&#91;<span class=\"hljs-string\">'last_name'<\/span>] = <span class=\"hljs-string\">'Abate'<\/span>;\n\n<span class=\"hljs-comment\">\/\/ execute the query with value Tom Abate<\/span>\n$statement-&gt;execute();<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-14\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this example, the <code>execute()<\/code> method evaluates the <code>$author<\/code> variable at the time of execution so that it uses <code>'Tom'<\/code> and <code>'Abage'<\/code> values instead.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='summary'>Summary <a href=\"#summary\" class=\"anchor\" id=\"summary\" title=\"Anchor for Summary\">#<\/a><\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>Use a PHP prepared statement to execute a query multiple times with different values.<\/li><li>Use positional placeholders (<code>?<\/code>) or named placeholders (<code>:parameter<\/code>) in the SQL statement before passing it the <code>prepare()<\/code> method of an <code>PDOStatement<\/code> object.<\/li><li>Use the <code>execute()<\/code> method with values to run an unbound statement.<\/li><li>Use <code>bindValue()<\/code> or <code>bindParam()<\/code> method to bind values to a bound statement. <\/li><\/ul>\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Did you find this tutorial useful?<\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"1321\"\n\t\t\t\tdata-post-url=\"https:\/\/www.phptutorial.net\/php-pdo\/php-prepared-statement\/\"\n\t\t\t\tdata-post-title=\"PHP Prepared Statement\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"1321\"\n\t\t\t\tdata-post-url=\"https:\/\/www.phptutorial.net\/php-pdo\/php-prepared-statement\/\"\n\t\t\t\tdata-post-title=\"PHP Prepared Statement\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\n\t\t\t<button class=\"btn btn-primary wth-btn-submit\">Send<\/button>\n\t\t\t<button class=\"btn wth-btn-cancel\">Cancel<\/button>\n\t\t\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>in this tutorial, you will learn about the PHP prepared statements in PDO and how to use them effectively.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":21,"menu_order":4,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1321","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.phptutorial.net\/wp-json\/wp\/v2\/pages\/1321","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.phptutorial.net\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.phptutorial.net\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.phptutorial.net\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.phptutorial.net\/wp-json\/wp\/v2\/comments?post=1321"}],"version-history":[{"count":5,"href":"https:\/\/www.phptutorial.net\/wp-json\/wp\/v2\/pages\/1321\/revisions"}],"predecessor-version":[{"id":2165,"href":"https:\/\/www.phptutorial.net\/wp-json\/wp\/v2\/pages\/1321\/revisions\/2165"}],"up":[{"embeddable":true,"href":"https:\/\/www.phptutorial.net\/wp-json\/wp\/v2\/pages\/21"}],"wp:attachment":[{"href":"https:\/\/www.phptutorial.net\/wp-json\/wp\/v2\/media?parent=1321"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}