{"id":746,"date":"2019-11-23T07:55:19","date_gmt":"2019-11-23T07:55:19","guid":{"rendered":"http:\/\/blog.hostinger.io\/hostinger-tutorials\/uncategorized\/how-to-connect-php-to-mysql\/"},"modified":"2026-03-09T19:19:22","modified_gmt":"2026-03-09T19:19:22","slug":"how-to-connect-php-to-mysql","status":"publish","type":"post","link":"\/ng\/tutorials\/how-to-connect-php-to-mysql","title":{"rendered":"How to connect PHP to MySQL database"},"content":{"rendered":"<?xml encoding=\"utf-8\" ?><p>For beginners in website development, understanding how to use PHP scripts to connect to MySQL can be highly advantageous. This enables you to modify, view, or manage the tables within the MySQL database. In this article, we&rsquo;ll guide you through the simplest methods to achieve this. Let&rsquo;s get started!<\/p><figure class=\"wp-block-image size-large\"><a href=\"https:\/\/assets.hostinger.com\/content\/tutorials\/pdf\/How-to-Speed-Up-Your-Website-EN.pdf\"><img loading=\"lazy\" decoding=\"async\" width=\"2048\" height=\"566\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook-Speed-Up-your-website.png\/public\" alt=\"\" class=\"wp-image-69260\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook-Speed-Up-your-website.png\/w=2048,fit=scale-down 2048w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook-Speed-Up-your-website.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook-Speed-Up-your-website.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook-Speed-Up-your-website.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook-Speed-Up-your-website.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 2048px) 100vw, 2048px\" \/><\/a><\/figure><p>\n\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-creating-a-mysql-database-optional\">Creating a MySQL Database (Optional)<\/h2><p>This step is required if you do not have a <strong>MySQL database<\/strong>. If you are a Hostinger user, you can easily make a new one via Hostinger&rsquo;s hPanel in a few steps:<\/p><ol class=\"wp-block-list\">\n<li>Locate <strong>MySQL Databases <\/strong>menu under the&nbsp;<strong>Databases&nbsp;<\/strong>section.<\/li>\n\n\n\n<li>Fill in the necessary fields and hit&nbsp;<strong>Create<\/strong>.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/10\/The-MySQL-Databases-section-in-the-hPanel.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1132\" height=\"421\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/10\/The-MySQL-Databases-section-in-the-hPanel.png\/public\" alt=\"The MySQL Databases section in the hPanel, showing you how to create a new MySQL database\" class=\"wp-image-66436\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/10\/The-MySQL-Databases-section-in-the-hPanel.png\/w=1132,fit=scale-down 1132w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/10\/The-MySQL-Databases-section-in-the-hPanel.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/10\/The-MySQL-Databases-section-in-the-hPanel.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/10\/The-MySQL-Databases-section-in-the-hPanel.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/10\/The-MySQL-Databases-section-in-the-hPanel.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1132px) 100vw, 1132px\" \/><\/a><\/figure><\/div><p><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/11\/mysqul-database-hostinger.png\"><\/a><\/p><p><div><p class=\"important\"><strong>Important!<\/strong> Write down the credentials of the MySQL database you just created for the next step. Don&rsquo;t forget to remember the database username and username password as well! <\/p><\/div>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-two-ways-a-php-script-can-connect-to-mysql\">Two Ways a PHP Script can Connect to MySQL<\/h2><p>There are two methods to connect to a MySQL database using PHP: <strong>MySQLi<\/strong>&nbsp;and <strong>PDO<\/strong>.<\/p><p><strong>MySQLi <\/strong>stands for<strong> MySQL Improved.&nbsp;<\/strong>It is a MySQL-exclusive extension that adds new features to a MySQL database&rsquo;s interface. MySQLi is both procedural and object-oriented, with the former being the attribute inherited from the older version of MySQL.<\/p><p>The original MySQL breaks down a task into linear, step-by-step procedures, which makes it difficult to modify because you have to edit the code from the top. Meanwhile, MySQLi sees data as a set of interchangeable objects with functions, allowing users to add or remove data easily.<\/p><p><strong>PDO <\/strong>stands for <strong>PHP Data Object<\/strong><strong>. <\/strong>Unlike MySQLi, PDO is only object-oriented and supports a number of different database types that use PHP, such as MySQL, MSSQL, Informix, and PostgreSQL.<\/p><p><div><p class=\"important\"><strong>Important!<\/strong> The original <strong>mysql_ <\/strong>functions are <strong>deprecated<\/strong> and should not be used as they are unsafe and no longer being maintained or developed. <\/p><\/div>\n\n\n\n<\/p><p>One of the most important features they both support is <strong>prepared statements<\/strong>, which accelerates the time needed for MySQL to execute the same query multiple times. It is also used to prevent SQL injection attacks when making changes to the database or inserting user-supplied input into a database query or statement.<\/p><p>Whichever method you use, you will need the correct information so you can connect to the MySQL database you have made. This is where the MySQL database details you have previously saved come in handy.<\/p><p>You also need the correct <strong>server name<\/strong> or <strong>hostname <\/strong>for the configuration. Hostinger uses <strong>&ldquo;localhost&rdquo; <\/strong>as its MySQL server&rsquo;s hostname. In general, this is the name that you&rsquo;ll want to use if you uploaded your PHP script to the same server as the database.<\/p><p>In contrast, if you&rsquo;re using a <a href=\"\/ng\/tutorials\/mysql\/how-to-grant-remote-access-mysql-vps\">MySQL remote connection<\/a> to connect to a database, you will have to use the <strong>IP address<\/strong> of the MySQL server. For more details, contact your hosting provider so they could provide you with the correct information on what to use as the hostname.<\/p><h2 class=\"wp-block-heading\" id=\"h-using-mysqli-to-connect-a-php-script-to-mysql\">Using MySQLi to Connect a PHP Script to MySQL<\/h2><p>Follow these steps to use MySQLi to connect a PHP script to MySQL:<\/p><ol class=\"wp-block-list\">\n<li>Head over to <strong>File Manager<\/strong> -&gt; <strong>public_html.<\/strong><\/li>\n<\/ol><div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/filemanager-publichtml-highlighted.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1157\" height=\"240\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/filemanager-publichtml-highlighted.png\/public\" alt=\"The public_html folder location in the File Manager\" class=\"wp-image-82396\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/filemanager-publichtml-highlighted.png\/w=1157,fit=scale-down 1157w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/filemanager-publichtml-highlighted.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/filemanager-publichtml-highlighted.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/filemanager-publichtml-highlighted.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/filemanager-publichtml-highlighted.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1157px) 100vw, 1157px\" \/><\/a><\/figure><\/div><ol start=\"2\" class=\"wp-block-list\">\n<li>Create a <strong>New File <\/strong>by clicking the icon from the sidebar menu.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/filemanager-newfile-highlighted.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"336\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/filemanager-newfile-highlighted.png\/public\" alt=\"The menu bar in the File Manager, showing how to create a New File inside public_html\" class=\"wp-image-82398\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/filemanager-newfile-highlighted.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/filemanager-newfile-highlighted.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/filemanager-newfile-highlighted.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/filemanager-newfile-highlighted.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><ol start=\"3\" class=\"wp-block-list\">\n<li>Save the file as <strong>databaseconnect.php<\/strong>. You can replace the name with whatever you like, just make sure it is using php as the extension.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/filemanager-newfile-databaseconnectphp-create-highlighted.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"565\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/filemanager-newfile-databaseconnectphp-create-highlighted.png\/public\" alt=\"The New File popup appears in the File Manager for users to create a new PHP file inside public_html\" class=\"wp-image-82399\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/filemanager-newfile-databaseconnectphp-create-highlighted.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/filemanager-newfile-databaseconnectphp-create-highlighted.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/filemanager-newfile-databaseconnectphp-create-highlighted.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/filemanager-newfile-databaseconnectphp-create-highlighted.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><ol start=\"4\" class=\"wp-block-list\">\n<li>Double-click to open the file and copy-paste the following lines of code into it. Change the first four values below <strong>&lt;?php<\/strong> with the credentials you noted earlier:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?php\n$servername = \"localhost\";\n$database = \"u123456789_DatabaseName\";\n$username = \"u123456789_User\";\n$password = \"MyStr0ngPa$!\";\n \n\/\/ Create connection\n \n$conn = mysqli_connect($servername, $username, $password, $database);\n \n\/\/ Check connection\n \nif (!$conn) {\n \n    die(\"Connection failed: \" . mysqli_connect_error());\n \n}\necho \"Connected successfully\";\nmysqli_close($conn);\n?&gt;<\/pre><h3 class=\"wp-block-heading\" id=\"h-mysqli-code-explained\">MySQLi Code Explained<\/h3><p>The main method used in this script is <strong>mysqli_connect()<\/strong>. This is an internal PHP function to establish a new connection to a MySQL server.<\/p><p>At the beginning of our code, we see a few variable declarations and values assigned to those variables. Usually, we need four of them to establish a proper database connection: <strong>$servername, $database, $username, <\/strong>and <strong>$password<\/strong>. In the code, we set our database details as values for those variables, so they can be passed into the function.<\/p><p>If the connection is not successful, the&nbsp;<strong>die()<\/strong> function is executed. This basically kills our script and gives us a connect error message that we have set. By default, the MySQL connect error will say <strong>Connection failed <\/strong>followed by an exact error message describing the issue.<\/p><p>On the other hand, if the MySQL connection is successful, the code will print <strong>Connected successfully<\/strong> instead.<\/p><p>The last part of the code is <strong>mysqli_close<\/strong>, which will simply close the connection to the database manually. If not specified, the MySQL connections will close by itself once the script ends.<\/p><h2 class=\"wp-block-heading\" id=\"h-using-pdo-to-connect-a-php-script-to-mysql\">Using PDO to Connect a PHP Script to MySQL<\/h2><p>The other method using PHP script to connect to MySQL is by using PDO. This is similar to the previous method, but with a slight variation:<\/p><ol class=\"wp-block-list\">\n<li>In the<strong> public_html<\/strong>, create a file named<strong> pdoconfig.php<\/strong> and insert the following code. As always, don&rsquo;t forget to replace the placeholder values with your database information. <strong>Save and Close<\/strong> it once you&rsquo;re done:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?php\n$host = \"localhost\";\n$dbname = \"u123456789_DatabaseName\";\n$username = \"u123456789_User\";\n$password = \"MyStr0ngPa$!\";<\/pre><ol start=\"2\" class=\"wp-block-list\">\n<li>Create another file named <strong>databaseconnect.php<\/strong> in the same directory, but with the following code. If you named the previous file differently, make sure to change the value of <strong>require_once<\/strong>.<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?php\nrequire_once 'pdoconfig.php';\n\ntry {\n$conn = new PDO(\"mysql:host=$host;dbname=$dbname\", $username, $password);\necho \"Connected to $dbname at $host successfully.\";\n} catch (PDOException $pe) {\ndie (\"Could not connect to the database $dbname :\" . $pe-&gt;getMessage());\n}<\/pre><h3 class=\"wp-block-heading\" id=\"h-pdo-code-explained\"><strong>PDO Code Explained<\/strong><\/h3><p>A PDO database connection requires you to create a new PDO object with a <strong>Data Source Name (DSN), Username,<\/strong> and <strong>Password<\/strong>.<\/p><p>The DSN defines the type of database, the name of the database, and any other information related to the database if required. These are the variables and values we stated inside the <strong>dbconfig.php&nbsp;<\/strong>file, referenced one time by the line <strong>require_once&nbsp;<\/strong>in the&nbsp;<strong>databaseconnect.php.<\/strong><\/p><p>In the latter, you will find the <strong>try&hellip;catch.. <\/strong>code. This means that the script will <strong>try<\/strong> to MySQL connect using the code provided, but if there is a problem, the code in the <strong>catch<\/strong> section will run. You can use the <strong>catch block<\/strong> to display connect error messages or run alternate code if the <strong>try block<\/strong> fails.<\/p><p>If the connection is successful, it will print out the message &ldquo;<strong>Connected to $dbname at $host successfully.<\/strong>&rdquo; However, if the attempt fails, the catch code will show a simple error message and kill the script.<\/p><p>Unlike when using MySQLi, after you&rsquo;re finished using a PDO script, you don&rsquo;t need to manually close the connection. It is automatically closed when the PDO object is destroyed, or your script ends.<\/p><h2 class=\"wp-block-heading\" id=\"h-checking-connectivity-and-troubleshooting-common-errors\">Checking Connectivity and Troubleshooting Common Errors<\/h2><p>To check whether the connection is successful, access your domain like so: <strong>yourdomain\/databaseconnect.php<\/strong>. If you name the PHP file with something different, make sure to change it accordingly.<\/p><p>You will see &ldquo;<strong>Connected<\/strong> <strong>successfully<\/strong>&rdquo; or variants of this message if everything is running without any issue.<\/p><p>Now if the connection was not successful, you will see something different. The error messages look slightly different for MySQLi and PDO.<\/p><h3 class=\"wp-block-heading\" id=\"h-incorrect-password-error\">Incorrect Password Error<\/h3><p>This error happens if we change the password or any credential in the PHP code (but do not change it in the actual database).<\/p><p>In case you see an &ldquo;<strong>Access denied<\/strong>&rdquo; or &ldquo;<strong>Could not connect to database<\/strong>&rdquo; message accompanied by &ldquo;<strong>(using password: YES)<\/strong>&rdquo; at the end, the first thing to do is to check the database details. There could be a typo or a part that&rsquo;s missing.<\/p><h3 class=\"wp-block-heading\" id=\"h-cannot-connect-to-mysql-server\">Cannot Connect to MySQL Server<\/h3><p>If you get &ldquo;<strong>Can&rsquo;t connect to MySQL server on &lsquo;server&rsquo; (110)<\/strong>&rdquo; in MySQLi, it means the script did not get a response from a server. This happens when we set &ldquo;<strong>server&rdquo;<\/strong> instead of &ldquo;<strong>localhost&rdquo;<\/strong>&nbsp;as the<strong> $servername,<\/strong> and this name is not recognized.<\/p><p>The error message in PDO will look like &ldquo;<strong>Connection failed: SQLSTATE[Hy000] [2002]&rdquo; <\/strong>followed by more details stating that the My SQL host was not found. But the way to troubleshoot it is the same as the above.<\/p><p>And of course, it is always important to remember one golden rule of troubleshooting an error: <a href=\"\/ng\/tutorials\/website\/how-to-check-your-website-error-log\">checking your site error log<\/a>.<\/p><p>The log can be found in the same folder where the script is running. For example, if we are running a script in <strong>public_html<\/strong>, we will find the <strong>error_log<\/strong> in the same folder.<\/p><h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2><p>In this tutorial, we have learned the very basic knowledge about how to connect a PHP script to a MySQL database using <strong>MySQLi<\/strong> and <strong>PHP Data Objects (PDO)<\/strong>.<\/p><p>Hopefully, this guide was helpful for those who are just starting out with web development. After all, connecting to a database is the first, most important step when working with more advanced scripts and configurations.<\/p><p>Let us know in the comments below if you face any issue following this guide.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For beginners in website development, understanding how to use PHP scripts to connect to MySQL can be highly advantageous. This enables you to modify, view, or manage the tables within the MySQL database. In this article, we&rsquo;ll guide you through the simplest methods to achieve this. Let&rsquo;s get started! Creating a MySQL Database (Optional) This [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/ng\/tutorials\/how-to-connect-php-to-mysql\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":2,"featured_media":144923,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"How to Connect PHP to MySQL Database with PDO and MySQLi","rank_math_description":"Our complete guide will show you how to connect PHP to MySQL database using two different methods: MySQLi and PDO. Complete scripts provided.","rank_math_focus_keyword":"php mysql connect","footnotes":""},"categories":[22644],"tags":[],"class_list":["post-746","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vps"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/how-to-connect-php-to-mysql","default":0},{"locale":"pt-BR","link":"https:\/\/www.hostinger.com\/br\/tutoriais\/como-conectar-php-com-mysql","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/tutoriels\/connecter-php-base-donnees-mysql","default":0},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/tutoriales\/conectar-php-mysql","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/tutorial\/koneksi-database-php","default":0},{"locale":"it-IT","link":"https:\/\/www.hostinger.com\/it\/tutorial\/collegare-php-a-mysql","default":0},{"locale":"en-UK","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/how-to-connect-php-to-mysql","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/how-to-connect-php-to-mysql","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/how-to-connect-php-to-mysql","default":0},{"locale":"es-MX","link":"https:\/\/www.hostinger.com\/mx\/tutoriales\/conectar-php-mysql","default":0},{"locale":"es-CO","link":"https:\/\/www.hostinger.com\/co\/tutoriales\/conectar-php-mysql","default":0},{"locale":"es-AR","link":"https:\/\/www.hostinger.com\/ar\/tutoriales\/conectar-php-mysql","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/pt\/tutoriais\/como-conectar-php-com-mysql","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/how-to-connect-php-to-mysql","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/how-to-connect-php-to-mysql","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/how-to-connect-php-to-mysql","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/how-to-connect-php-to-mysql","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/746","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/comments?post=746"}],"version-history":[{"count":36,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/746\/revisions"}],"predecessor-version":[{"id":144922,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/746\/revisions\/144922"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/media\/144923"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/media?parent=746"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/categories?post=746"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/tags?post=746"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}