{"id":343,"date":"2019-12-26T16:20:46","date_gmt":"2019-12-26T10:50:46","guid":{"rendered":"https:\/\/wpproonline.com\/?p=343"},"modified":"2026-02-26T10:48:08","modified_gmt":"2026-02-26T10:48:08","slug":"how-to-prevent-sql-injection-in-php","status":"publish","type":"post","link":"https:\/\/www.digitalhubz.com\/blog\/how-to-prevent-sql-injection-in-php\/","title":{"rendered":"How to prevent SQL injection in PHP"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>Use prepared statements and parameterized queries.<\/strong>\u00a0These are SQL statements that are sent to and parsed by the database server separately from any parameters. This way it is impossible for an attacker to inject malicious SQL.<\/p>\n\n<p><!--more--><\/p>\n\n<p class=\"wp-block-paragraph\"><strong>You basically have two options to achieve this:<\/strong><\/p>\n\n<p class=\"wp-block-paragraph\">1.Using\u00a0<a href=\"http:\/\/php.net\/manual\/en\/book.pdo.php\">PDO<\/a>\u00a0(for any supported database driver):<\/p>\n\n<pre data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$stmt = $pdo-&gt;prepare('SELECT * FROM employees WHERE name = :name');\n$stmt-&gt;execute(array('name' =&gt; $name));\nforeach ($stmt as $row) {\n    \/\/ Do something with $row\n}<\/pre>\n\n<p class=\"wp-block-paragraph\">2. Using\u00a0<a href=\"http:\/\/php.net\/manual\/en\/book.mysqli.php\">MySQLi<\/a>\u00a0(for MySQL):<\/p>\n\n<pre data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$stmt = $dbConnection-&gt;prepare('SELECT * FROM employees WHERE name = ?');\n$stmt-&gt;bind_param('s', $name); \/\/ 's' specifies the variable type =&gt; 'string'\n$stmt-&gt;execute();\n$result = $stmt-&gt;get_result();\nwhile ($row = $result-&gt;fetch_assoc()) {\n    \/\/ Do something with $row\n}<\/pre>\n\n<p class=\"wp-block-paragraph\">If you&#8217;re connecting to a database other than MySQL, there is a driver-specific second option that you can refer to (for example, <code>pg_prepare()<\/code> and <code>pg_execute()<\/code> for PostgreSQL). PDO is the universal option.<\/p>\n\n<h2 class=\"wp-block-heading\">Correctly setting up the connection<\/h2>\n\n<p class=\"wp-block-paragraph\">Note that when using\u00a0<code>PDO<\/code>\u00a0to access a MySQL database\u00a0<em>real<\/em>\u00a0prepared statements are\u00a0<strong>not used by default<\/strong>. To fix this you have to disable the emulation of prepared statements. An example of creating a connection using PDO is:<\/p>\n\n<pre data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$dbConnection = new PDO('mysql:dbname=dbtest;host=127.0.0.1;charset=utf8', 'user', 'password');\n$dbConnection-&gt;setAttribute(PDO::ATTR_EMULATE_PREPARES, false);\n$dbConnection-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);<\/pre>\n\n<p class=\"wp-block-paragraph\">In the above example the error mode isn&#8217;t strictly necessary,\u00a0<strong>but it is advised to add it<\/strong>. This way the script will not stop with a\u00a0<code>Fatal Error<\/code>\u00a0when something goes wrong. And it gives the developer the chance to\u00a0<code>catch<\/code>\u00a0any error(s) which are\u00a0<code>throw<\/code>n as\u00a0<code>PDOException<\/code>s.<\/p>\n\n<p class=\"wp-block-paragraph\">What is\u00a0<strong>mandatory<\/strong>, however, is the first\u00a0<code>setAttribute()<\/code>\u00a0line, which tells PDO to disable emulated prepared statements and use\u00a0<em>real<\/em>\u00a0prepared statements. This makes sure the statement and the values aren&#8217;t parsed by PHP before sending it to the MySQL server (giving a possible attacker no chance to inject malicious SQL).<\/p>\n\n<p class=\"wp-block-paragraph\">Although you can set the\u00a0<code>charset<\/code>\u00a0in the options of the constructor, it&#8217;s important to note that &#8216;older&#8217; versions of PHP (before 5.3.6)\u00a0<a href=\"http:\/\/php.net\/manual\/en\/ref.pdo-mysql.connection.php\">silently ignored the charset parameter<\/a>\u00a0in the DSN.<\/p>\n\n<h2 class=\"wp-block-heading\">Explanation<\/h2>\n\n<p class=\"wp-block-paragraph\">The SQL statement you pass to\u00a0<code>prepare<\/code>\u00a0is parsed and compiled by the database server. By specifying parameters (either a\u00a0<code>?<\/code>\u00a0or a named parameter like\u00a0<code>:name<\/code>\u00a0in the example above) you tell the database engine where you want to filter on. Then when you call\u00a0<code>execute<\/code>, the prepared statement is combined with the parameter values you specify.<\/p>\n\n<p class=\"wp-block-paragraph\">The important thing here is that the parameter values are combined with the compiled statement, not an SQL string. SQL injection works by tricking the script into including malicious strings when it creates SQL to send to the database. So by sending the actual SQL separately from the parameters, you limit the risk of ending up with something you didn&#8217;t intend.<\/p>\n\n<p class=\"wp-block-paragraph\">Any parameters you send when using a prepared statement will just be treated as strings (although the database engine may do some optimization so parameters may end up as numbers too, of course). In the example above, if the\u00a0<code>$name<\/code>\u00a0variable contains\u00a0<code>'Sarah'; DELETE FROM employees<\/code>\u00a0the result would simply be a search for the string\u00a0<code>\"'Sarah'; DELETE FROM employees\"<\/code>, and you will not end up with\u00a0<a href=\"http:\/\/xkcd.com\/327\/\">an empty table<\/a>.<\/p>\n\n<p class=\"wp-block-paragraph\">Another benefit of using prepared statements is that if you execute the same statement many times in the same session it will only be parsed and compiled once, giving you some speed gains.<\/p>\n\n<p class=\"wp-block-paragraph\">Oh, and since you asked about how to do it for an insert, here&#8217;s an example (using PDO):<\/p>\n\n<pre data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$preparedStatement = $db-&gt;prepare('INSERT INTO table (column) VALUES (:column)');\n$preparedStatement-&gt;execute(array('column' =&gt; $unsafeValue));<\/pre>\n\n<h2 class=\"wp-block-heading\">Can prepared statements be used for dynamic queries?<\/h2>\n\n<p class=\"wp-block-paragraph\">While you can still use prepared statements for the query parameters, the structure of the dynamic query itself cannot be parametrized and certain query features cannot be parametrized.<\/p>\n\n<p class=\"wp-block-paragraph\">For these specific scenarios, the best thing to do is use a whitelist filter that restricts the possible values.<\/p>\n\n<pre data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ Value whitelist\n\/\/ $dir can only be 'DESC', otherwise it will be 'ASC'\nif (empty($dir) || $dir !== 'DESC') {\n   $dir = 'ASC';\n}<\/pre>\n\n<p class=\"wp-block-paragraph\">Source: <a href=\"https:\/\/stackoverflow.com\/questions\/60174\/how-can-i-prevent-sql-injection-in-\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"StackOverflow (opens in a new tab)\">StackOverflow<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Use prepared statements and parameterized queries.\u00a0These are SQL statements that are sent to and parsed by the database server separately from any parameters. This way it is impossible for an&hellip;<\/p>\n","protected":false},"author":1,"featured_media":347,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[138,89],"tags":[137,139,140,141,142],"class_list":["post-343","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mysql","category-php","tag-mysql","tag-mysql-injection","tag-php","tag-sql","tag-sql-injection"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.0 (Yoast SEO v27.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How to prevent SQL injection in PHP - DigitalHubZ<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.digitalhubz.com\/blog\/how-to-prevent-sql-injection-in-php\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to prevent SQL injection in PHP\" \/>\n<meta property=\"og:description\" content=\"Use prepared statements and parameterized queries.\u00a0These are SQL statements that are sent to and parsed by the database server separately from any parameters. This way it is impossible for an&hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.digitalhubz.com\/blog\/how-to-prevent-sql-injection-in-php\/\" \/>\n<meta property=\"og:site_name\" content=\"DigitalHubZ\" \/>\n<meta property=\"article:published_time\" content=\"2019-12-26T10:50:46+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-02-26T10:48:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.digitalhubz.com\/blog\/wp-content\/uploads\/2019\/12\/0_ErN7MyOU7wjQLSgM.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"539\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DigitalHubZ\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DigitalHubZ\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.digitalhubz.com\\\/blog\\\/how-to-prevent-sql-injection-in-php\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.digitalhubz.com\\\/blog\\\/how-to-prevent-sql-injection-in-php\\\/\"},\"author\":{\"name\":\"DigitalHubZ\",\"@id\":\"https:\\\/\\\/www.digitalhubz.com\\\/blog\\\/#\\\/schema\\\/person\\\/5a4074d837d6e5d22d665e5b7ca9e873\"},\"headline\":\"How to prevent SQL injection in PHP\",\"datePublished\":\"2019-12-26T10:50:46+00:00\",\"dateModified\":\"2026-02-26T10:48:08+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.digitalhubz.com\\\/blog\\\/how-to-prevent-sql-injection-in-php\\\/\"},\"wordCount\":551,\"commentCount\":6,\"publisher\":{\"@id\":\"https:\\\/\\\/www.digitalhubz.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.digitalhubz.com\\\/blog\\\/how-to-prevent-sql-injection-in-php\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.digitalhubz.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/12\\\/0_ErN7MyOU7wjQLSgM.jpg\",\"keywords\":[\"MySQL\",\"MySQL injection\",\"PHP\",\"SQL\",\"SQL injection\"],\"articleSection\":[\"MySql\",\"PHP\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.digitalhubz.com\\\/blog\\\/how-to-prevent-sql-injection-in-php\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.digitalhubz.com\\\/blog\\\/how-to-prevent-sql-injection-in-php\\\/\",\"url\":\"https:\\\/\\\/www.digitalhubz.com\\\/blog\\\/how-to-prevent-sql-injection-in-php\\\/\",\"name\":\"How to prevent SQL injection in PHP - DigitalHubZ\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.digitalhubz.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.digitalhubz.com\\\/blog\\\/how-to-prevent-sql-injection-in-php\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.digitalhubz.com\\\/blog\\\/how-to-prevent-sql-injection-in-php\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.digitalhubz.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/12\\\/0_ErN7MyOU7wjQLSgM.jpg\",\"datePublished\":\"2019-12-26T10:50:46+00:00\",\"dateModified\":\"2026-02-26T10:48:08+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.digitalhubz.com\\\/blog\\\/how-to-prevent-sql-injection-in-php\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.digitalhubz.com\\\/blog\\\/how-to-prevent-sql-injection-in-php\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.digitalhubz.com\\\/blog\\\/how-to-prevent-sql-injection-in-php\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.digitalhubz.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/12\\\/0_ErN7MyOU7wjQLSgM.jpg\",\"contentUrl\":\"https:\\\/\\\/www.digitalhubz.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/12\\\/0_ErN7MyOU7wjQLSgM.jpg\",\"width\":1024,\"height\":539},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.digitalhubz.com\\\/blog\\\/how-to-prevent-sql-injection-in-php\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.digitalhubz.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to prevent SQL injection in PHP\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.digitalhubz.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.digitalhubz.com\\\/blog\\\/\",\"name\":\"DigitalHubZ\",\"description\":\"Future-Ready Digital Solutions\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.digitalhubz.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.digitalhubz.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.digitalhubz.com\\\/blog\\\/#organization\",\"name\":\"DigitalHubZ\",\"url\":\"https:\\\/\\\/www.digitalhubz.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.digitalhubz.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.digitalhubz.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/03\\\/digitalhubz.webp\",\"contentUrl\":\"https:\\\/\\\/www.digitalhubz.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/03\\\/digitalhubz.webp\",\"width\":1232,\"height\":369,\"caption\":\"DigitalHubZ\"},\"image\":{\"@id\":\"https:\\\/\\\/www.digitalhubz.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.digitalhubz.com\\\/blog\\\/#\\\/schema\\\/person\\\/5a4074d837d6e5d22d665e5b7ca9e873\",\"name\":\"DigitalHubZ\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/414c5bb85907e15e0f840541718ecc7420d52ea432b33f6a57761a674a52ebb7?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/414c5bb85907e15e0f840541718ecc7420d52ea432b33f6a57761a674a52ebb7?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/414c5bb85907e15e0f840541718ecc7420d52ea432b33f6a57761a674a52ebb7?s=96&d=mm&r=g\",\"caption\":\"DigitalHubZ\"},\"sameAs\":[\"https:\\\/\\\/digitalhubz.com\"],\"url\":\"https:\\\/\\\/www.digitalhubz.com\\\/blog\\\/author\\\/digi_v1_wp\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to prevent SQL injection in PHP - DigitalHubZ","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.digitalhubz.com\/blog\/how-to-prevent-sql-injection-in-php\/","og_locale":"en_US","og_type":"article","og_title":"How to prevent SQL injection in PHP","og_description":"Use prepared statements and parameterized queries.\u00a0These are SQL statements that are sent to and parsed by the database server separately from any parameters. This way it is impossible for an&hellip;","og_url":"https:\/\/www.digitalhubz.com\/blog\/how-to-prevent-sql-injection-in-php\/","og_site_name":"DigitalHubZ","article_published_time":"2019-12-26T10:50:46+00:00","article_modified_time":"2026-02-26T10:48:08+00:00","og_image":[{"width":1024,"height":539,"url":"https:\/\/www.digitalhubz.com\/blog\/wp-content\/uploads\/2019\/12\/0_ErN7MyOU7wjQLSgM.jpg","type":"image\/jpeg"}],"author":"DigitalHubZ","twitter_card":"summary_large_image","twitter_misc":{"Written by":"DigitalHubZ","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.digitalhubz.com\/blog\/how-to-prevent-sql-injection-in-php\/#article","isPartOf":{"@id":"https:\/\/www.digitalhubz.com\/blog\/how-to-prevent-sql-injection-in-php\/"},"author":{"name":"DigitalHubZ","@id":"https:\/\/www.digitalhubz.com\/blog\/#\/schema\/person\/5a4074d837d6e5d22d665e5b7ca9e873"},"headline":"How to prevent SQL injection in PHP","datePublished":"2019-12-26T10:50:46+00:00","dateModified":"2026-02-26T10:48:08+00:00","mainEntityOfPage":{"@id":"https:\/\/www.digitalhubz.com\/blog\/how-to-prevent-sql-injection-in-php\/"},"wordCount":551,"commentCount":6,"publisher":{"@id":"https:\/\/www.digitalhubz.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.digitalhubz.com\/blog\/how-to-prevent-sql-injection-in-php\/#primaryimage"},"thumbnailUrl":"https:\/\/www.digitalhubz.com\/blog\/wp-content\/uploads\/2019\/12\/0_ErN7MyOU7wjQLSgM.jpg","keywords":["MySQL","MySQL injection","PHP","SQL","SQL injection"],"articleSection":["MySql","PHP"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.digitalhubz.com\/blog\/how-to-prevent-sql-injection-in-php\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.digitalhubz.com\/blog\/how-to-prevent-sql-injection-in-php\/","url":"https:\/\/www.digitalhubz.com\/blog\/how-to-prevent-sql-injection-in-php\/","name":"How to prevent SQL injection in PHP - DigitalHubZ","isPartOf":{"@id":"https:\/\/www.digitalhubz.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.digitalhubz.com\/blog\/how-to-prevent-sql-injection-in-php\/#primaryimage"},"image":{"@id":"https:\/\/www.digitalhubz.com\/blog\/how-to-prevent-sql-injection-in-php\/#primaryimage"},"thumbnailUrl":"https:\/\/www.digitalhubz.com\/blog\/wp-content\/uploads\/2019\/12\/0_ErN7MyOU7wjQLSgM.jpg","datePublished":"2019-12-26T10:50:46+00:00","dateModified":"2026-02-26T10:48:08+00:00","breadcrumb":{"@id":"https:\/\/www.digitalhubz.com\/blog\/how-to-prevent-sql-injection-in-php\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.digitalhubz.com\/blog\/how-to-prevent-sql-injection-in-php\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.digitalhubz.com\/blog\/how-to-prevent-sql-injection-in-php\/#primaryimage","url":"https:\/\/www.digitalhubz.com\/blog\/wp-content\/uploads\/2019\/12\/0_ErN7MyOU7wjQLSgM.jpg","contentUrl":"https:\/\/www.digitalhubz.com\/blog\/wp-content\/uploads\/2019\/12\/0_ErN7MyOU7wjQLSgM.jpg","width":1024,"height":539},{"@type":"BreadcrumbList","@id":"https:\/\/www.digitalhubz.com\/blog\/how-to-prevent-sql-injection-in-php\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.digitalhubz.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to prevent SQL injection in PHP"}]},{"@type":"WebSite","@id":"https:\/\/www.digitalhubz.com\/blog\/#website","url":"https:\/\/www.digitalhubz.com\/blog\/","name":"DigitalHubZ","description":"Future-Ready Digital Solutions","publisher":{"@id":"https:\/\/www.digitalhubz.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.digitalhubz.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.digitalhubz.com\/blog\/#organization","name":"DigitalHubZ","url":"https:\/\/www.digitalhubz.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.digitalhubz.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.digitalhubz.com\/blog\/wp-content\/uploads\/2023\/03\/digitalhubz.webp","contentUrl":"https:\/\/www.digitalhubz.com\/blog\/wp-content\/uploads\/2023\/03\/digitalhubz.webp","width":1232,"height":369,"caption":"DigitalHubZ"},"image":{"@id":"https:\/\/www.digitalhubz.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.digitalhubz.com\/blog\/#\/schema\/person\/5a4074d837d6e5d22d665e5b7ca9e873","name":"DigitalHubZ","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/414c5bb85907e15e0f840541718ecc7420d52ea432b33f6a57761a674a52ebb7?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/414c5bb85907e15e0f840541718ecc7420d52ea432b33f6a57761a674a52ebb7?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/414c5bb85907e15e0f840541718ecc7420d52ea432b33f6a57761a674a52ebb7?s=96&d=mm&r=g","caption":"DigitalHubZ"},"sameAs":["https:\/\/digitalhubz.com"],"url":"https:\/\/www.digitalhubz.com\/blog\/author\/digi_v1_wp\/"}]}},"_links":{"self":[{"href":"https:\/\/www.digitalhubz.com\/blog\/wp-json\/wp\/v2\/posts\/343","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.digitalhubz.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.digitalhubz.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.digitalhubz.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.digitalhubz.com\/blog\/wp-json\/wp\/v2\/comments?post=343"}],"version-history":[{"count":4,"href":"https:\/\/www.digitalhubz.com\/blog\/wp-json\/wp\/v2\/posts\/343\/revisions"}],"predecessor-version":[{"id":54871,"href":"https:\/\/www.digitalhubz.com\/blog\/wp-json\/wp\/v2\/posts\/343\/revisions\/54871"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.digitalhubz.com\/blog\/wp-json\/wp\/v2\/media\/347"}],"wp:attachment":[{"href":"https:\/\/www.digitalhubz.com\/blog\/wp-json\/wp\/v2\/media?parent=343"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.digitalhubz.com\/blog\/wp-json\/wp\/v2\/categories?post=343"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.digitalhubz.com\/blog\/wp-json\/wp\/v2\/tags?post=343"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}