<?xml version="1.0" encoding="UTF-8" standalone="no"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:gd="http://schemas.google.com/g/2005" xmlns:georss="http://www.georss.org/georss" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-6184319049478717608</atom:id><lastBuildDate>Wed, 06 Nov 2024 02:51:05 +0000</lastBuildDate><category>PHP</category><category>AJAX</category><category>Web Developer</category><category>Android</category><category>Pemula</category><category>Tips &amp; Trik</category><title>Develovers</title><description></description><link>http://develovers.blogspot.com/</link><managingEditor>noreply@blogger.com (Belajar Online)</managingEditor><generator>Blogger</generator><openSearch:totalResults>9</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><language>en-us</language><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6184319049478717608.post-1475930063948506206</guid><pubDate>Mon, 21 Mar 2022 19:50:00 +0000</pubDate><atom:updated>2022-03-21T13:01:03.585-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">AJAX</category><category domain="http://www.blogger.com/atom/ns#">PHP</category><title>Pemrosesan ServerSide DataTables dengan PHP dan MySQL</title><description>&lt;p&gt;DataTables adalah perpustakaan jQuery yang menampilkan catatan daftar dalam tabel HTML menggunakan antarmuka yang intuitif. Ini menawarkan fitur seperti pencarian, pagination, dan sort.&lt;/p&gt;&lt;p&gt;Dalam artikel sebelumnya, kami melihat kode khusus yang memungkinkan pencarian dan pagination catatan. Selain itu, DataTables akan memungkinkan kita untuk membatasi jumlah record yang ditampilkan pada sebuah halaman.&lt;/p&gt;&lt;p&gt;Ekstensi DataTables mendukung pemrosesan sisi klien dan sisi server. Artikel ini akan menunjukkan kepada Anda hasil database menggunakan pemrosesan sisi server DataTables.&lt;/p&gt;&lt;p&gt;File PHP memanggil kelas domain dengan mengirimkan tabel, kolom, dan detail konfigurasi ke fungsi. Kelas domain mengeksekusi kueri dan mengembalikan larik hasil. Format JSON mengkodekan array yang dihasilkan dan akan dikirim sebagai respons terhadap program AJAX DataTables .&lt;/p&gt;&lt;h3 style="text-align: left;"&gt;Kode Pendefinisian DataTable&lt;/h3&gt;&lt;p&gt;Kode ini mendefinisikan kode HTML untuk DataTable. Kode ini membutuhkan pustaka CSS dan JavaScript. Tag HTML tabel berisi atribut id yang digunakan untuk mendefinisikan dan menetapkan tabel sebagai DataTable.&lt;/p&gt;
&lt;script src="https://gist.github.com/fikriyogi/72f43a11ee09cf954598cb5b7d5b4f2a.js"&gt;&lt;/script&gt;
a</description><link>http://develovers.blogspot.com/2022/03/pemrosesan-serverside-datatables-dengan.html</link><thr:total>0</thr:total><author>noreply@blogger.com (...:::HiToKiRi.rEd:::...)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6184319049478717608.post-1000437393014141641</guid><pubDate>Tue, 08 Jun 2021 12:02:00 +0000</pubDate><atom:updated>2021-06-08T05:08:54.466-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">AJAX</category><category domain="http://www.blogger.com/atom/ns#">PHP</category><title>MySQL Database Live Search with PHP and AJAX</title><description>&lt;p&gt;&lt;span style="background-color: white; color: #333333; font-family: Merriweather, serif; font-size: 17px;"&gt;In this tutorial you'll learn how to create a live MySQL database search feature using PHP and Ajax.&lt;/span&gt;&lt;/p&gt;&lt;h2 style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Source Sans Pro&amp;quot;, sans-serif; font-size: 1.45em; line-height: 1.2625em;"&gt;Ajax Live Database Search&lt;/h2&gt;&lt;p style="background-color: white; box-sizing: border-box; color: #333333; font-family: Merriweather, serif; font-size: 17px;"&gt;You can create a simple live database search functionality utilizing the Ajax and PHP, where the search results will be displayed as you start typing some character in search input box.&lt;/p&gt;&lt;p style="background-color: white; box-sizing: border-box; color: #333333; font-family: Merriweather, serif; font-size: 17px;"&gt;In this tutorial we're going to create a live search box that will search the&amp;nbsp;&lt;i style="box-sizing: border-box;"&gt;countries&lt;/i&gt;&amp;nbsp;table and show the results asynchronously. But, first of all we need to create this table.&lt;/p&gt;&lt;h3 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Merriweather, serif; font-size: 1.25em; line-height: 1.5;"&gt;Step 1: Creating the Database Table&lt;/h3&gt;&lt;p style="background-color: white; box-sizing: border-box; color: #333333; font-family: Merriweather, serif; font-size: 17px;"&gt;Execute the following SQL query to create the&amp;nbsp;&lt;i style="box-sizing: border-box;"&gt;countries&lt;/i&gt;&amp;nbsp;table in your MySQL database.&lt;/p&gt;&lt;div class="example" style="background-color: white; box-sizing: border-box; color: #333333; font-family: Merriweather, serif; font-size: 17px;"&gt;&lt;div class="codebox" style="box-sizing: border-box;"&gt;&lt;div class="codebox-title" style="box-sizing: border-box;"&gt;&lt;h4 style="box-sizing: border-box;"&gt;Example&lt;/h4&gt;&lt;a class="download-btn" href="https://www.tutorialrepublic.com/examples/downloads/countries-table.zip" style="box-sizing: border-box; color: #27aae1;" target="_top" title="Download Countries Table"&gt;&lt;span style="box-sizing: border-box;"&gt;Download&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;pre class="syntax-highlighter line-numbers language-sql" style="background-color: #e0e0e0; box-sizing: border-box; overflow: auto; padding: 10px;"&gt;&lt;code class="language-sql" style="box-sizing: border-box; display: initial;"&gt;&lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;CREATE&lt;/span&gt; &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;TABLE&lt;/span&gt; countries &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;
    id &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;INT&lt;/span&gt; &lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;NOT&lt;/span&gt; &lt;span class="token boolean" style="box-sizing: border-box; display: initial;"&gt;NULL&lt;/span&gt; &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;PRIMARY&lt;/span&gt; &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;KEY&lt;/span&gt; &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;AUTO_INCREMENT&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;,&lt;/span&gt;
    name &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;VARCHAR&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token number" style="box-sizing: border-box; display: initial;"&gt;50&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt; &lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;NOT&lt;/span&gt; &lt;span class="token boolean" style="box-sizing: border-box; display: initial;"&gt;NULL&lt;/span&gt;
&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;&lt;span class="line-numbers-sizer" style="box-sizing: border-box; display: initial;"&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;p style="background-color: white; box-sizing: border-box; color: #333333; font-family: Merriweather, serif; font-size: 17px;"&gt;After creating the table, you need to populate it with some data using the&amp;nbsp;&lt;a href="https://www.tutorialrepublic.com/sql-tutorial/sql-create-table-statement.php" style="box-sizing: border-box; color: #27aae1;"&gt;SQL&amp;nbsp;&lt;code style="background-color: #e0e0e0; box-sizing: border-box;"&gt;INSERT&lt;/code&gt;&amp;nbsp;statement&lt;/a&gt;. Alternatively, you can download the prepopulated&amp;nbsp;&lt;i style="box-sizing: border-box;"&gt;countries&lt;/i&gt;&amp;nbsp;table by clicking the download button and import it in your MySQL database.&lt;/p&gt;&lt;p style="background-color: white; box-sizing: border-box; color: #333333; font-family: Merriweather, serif; font-size: 17px;"&gt;Please check out the tutorial on&amp;nbsp;&lt;a href="https://www.tutorialrepublic.com/sql-tutorial/sql-create-table-statement.php" style="box-sizing: border-box; color: #27aae1;"&gt;SQL&amp;nbsp;&lt;code style="background-color: #e0e0e0; box-sizing: border-box;"&gt;CREATE TABLE&lt;/code&gt;&amp;nbsp;statement&lt;/a&gt;&amp;nbsp;for the detailed information about syntax for creating tables in MySQL database system.&lt;/p&gt;&lt;h3 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Merriweather, serif; font-size: 1.25em; line-height: 1.5;"&gt;Step 2: Creating the Search Form&lt;/h3&gt;&lt;p style="background-color: white; box-sizing: border-box; color: #333333; font-family: Merriweather, serif; font-size: 17px;"&gt;Now, let's create a simple web interface that allows user to live search the names of countries available in our&amp;nbsp;&lt;i style="box-sizing: border-box;"&gt;countries&lt;/i&gt;&amp;nbsp;table, just like an autocomplete or typeahead.&lt;/p&gt;&lt;p style="background-color: white; box-sizing: border-box; color: #333333; font-family: Merriweather, serif; font-size: 17px;"&gt;Create a PHP file named "search-form.php" and put the following code inside of it.&lt;/p&gt;&lt;div class="example" style="background-color: white; box-sizing: border-box; color: #333333; font-family: Merriweather, serif; font-size: 17px;"&gt;&lt;div class="codebox" style="box-sizing: border-box;"&gt;&lt;div class="codebox-title" style="box-sizing: border-box;"&gt;&lt;h4 style="box-sizing: border-box;"&gt;Example&lt;/h4&gt;&lt;a class="download-btn" href="https://www.tutorialrepublic.com/examples/bin/download-source.php?topic=php&amp;amp;file=search-form" style="box-sizing: border-box; color: #27aae1;" target="_top" title="Download Source Code"&gt;&lt;span style="box-sizing: border-box;"&gt;Download&lt;/span&gt;&lt;/a&gt;&lt;span class="box-size" style="box-sizing: border-box;"&gt;&lt;i style="box-sizing: border-box;" title="Maximize"&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre class="syntax-highlighter line-numbers scroll xlarge language-markup" style="background-color: #e0e0e0; box-sizing: border-box; overflow: auto; padding: 10px;"&gt;&lt;code class="language-markup" style="box-sizing: border-box; display: initial;"&gt;&lt;span class="token doctype" style="box-sizing: border-box; display: initial;"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;lt;&lt;/span&gt;html&lt;/span&gt; &lt;span class="token attr-name" style="box-sizing: border-box; display: initial;"&gt;lang&lt;/span&gt;&lt;span class="token attr-value" style="box-sizing: border-box; display: initial;"&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;=&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;"&lt;/span&gt;en&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;"&lt;/span&gt;&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;lt;&lt;/span&gt;head&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;lt;&lt;/span&gt;meta&lt;/span&gt; &lt;span class="token attr-name" style="box-sizing: border-box; display: initial;"&gt;charset&lt;/span&gt;&lt;span class="token attr-value" style="box-sizing: border-box; display: initial;"&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;=&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;"&lt;/span&gt;UTF-8&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;"&lt;/span&gt;&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;lt;&lt;/span&gt;title&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;PHP Live MySQL Database Search&lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;lt;/&lt;/span&gt;title&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;lt;&lt;/span&gt;style&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="token style language-css" style="box-sizing: border-box; display: initial;"&gt;
    &lt;span class="token selector" style="box-sizing: border-box; display: initial;"&gt;body&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
        &lt;span class="token property" style="box-sizing: border-box; display: initial;"&gt;font-family&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;:&lt;/span&gt; Arail, sans-serif&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
    &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt;
    &lt;span class="token comment" style="box-sizing: border-box; display: none;"&gt;/* Formatting search box */&lt;/span&gt;
    &lt;span class="token selector" style="box-sizing: border-box; display: initial;"&gt;.search-box&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
        &lt;span class="token property" style="box-sizing: border-box; display: initial;"&gt;width&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;:&lt;/span&gt; 300px&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
        &lt;span class="token property" style="box-sizing: border-box; display: initial;"&gt;position&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;:&lt;/span&gt; relative&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
        &lt;span class="token property" style="box-sizing: border-box; display: initial;"&gt;display&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;:&lt;/span&gt; inline-block&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
        &lt;span class="token property" style="box-sizing: border-box; display: initial;"&gt;font-size&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;:&lt;/span&gt; 14px&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
    &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt;
    &lt;span class="token selector" style="box-sizing: border-box; display: initial;"&gt;.search-box input[type="text"]&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
        &lt;span class="token property" style="box-sizing: border-box; display: initial;"&gt;height&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;:&lt;/span&gt; 32px&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
        &lt;span class="token property" style="box-sizing: border-box; display: initial;"&gt;padding&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;:&lt;/span&gt; 5px 10px&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
        &lt;span class="token property" style="box-sizing: border-box; display: initial;"&gt;border&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;:&lt;/span&gt; 1px solid #CCCCCC&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
        &lt;span class="token property" style="box-sizing: border-box; display: initial;"&gt;font-size&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;:&lt;/span&gt; 14px&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
    &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt;
    &lt;span class="token selector" style="box-sizing: border-box; display: initial;"&gt;.result&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
        &lt;span class="token property" style="box-sizing: border-box; display: initial;"&gt;position&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;:&lt;/span&gt; absolute&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;        
        &lt;span class="token property" style="box-sizing: border-box; display: initial;"&gt;z-index&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;:&lt;/span&gt; 999&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
        &lt;span class="token property" style="box-sizing: border-box; display: initial;"&gt;top&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;:&lt;/span&gt; 100%&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
        &lt;span class="token property" style="box-sizing: border-box; display: initial;"&gt;left&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;:&lt;/span&gt; 0&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
    &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt;
    &lt;span class="token selector" style="box-sizing: border-box; display: initial;"&gt;.search-box input[type="text"], .result&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
        &lt;span class="token property" style="box-sizing: border-box; display: initial;"&gt;width&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;:&lt;/span&gt; 100%&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
        &lt;span class="token property" style="box-sizing: border-box; display: initial;"&gt;box-sizing&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;:&lt;/span&gt; border-box&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
    &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt;
    &lt;span class="token comment" style="box-sizing: border-box; display: none;"&gt;/* Formatting result items */&lt;/span&gt;
    &lt;span class="token selector" style="box-sizing: border-box; display: initial;"&gt;.result p&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
        &lt;span class="token property" style="box-sizing: border-box; display: initial;"&gt;margin&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;:&lt;/span&gt; 0&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
        &lt;span class="token property" style="box-sizing: border-box; display: initial;"&gt;padding&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;:&lt;/span&gt; 7px 10px&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
        &lt;span class="token property" style="box-sizing: border-box; display: initial;"&gt;border&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;:&lt;/span&gt; 1px solid #CCCCCC&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
        &lt;span class="token property" style="box-sizing: border-box; display: initial;"&gt;border-top&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;:&lt;/span&gt; none&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
        &lt;span class="token property" style="box-sizing: border-box; display: initial;"&gt;cursor&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;:&lt;/span&gt; pointer&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
    &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt;
    &lt;span class="token selector" style="box-sizing: border-box; display: initial;"&gt;.result p:hover&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
        &lt;span class="token property" style="box-sizing: border-box; display: initial;"&gt;background&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;:&lt;/span&gt; #f2f2f2&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
    &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;lt;/&lt;/span&gt;style&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;lt;&lt;/span&gt;script&lt;/span&gt; &lt;span class="token attr-name" style="box-sizing: border-box; display: initial;"&gt;src&lt;/span&gt;&lt;span class="token attr-value" style="box-sizing: border-box; display: initial;"&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;=&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;"&lt;/span&gt;https://code.jquery.com/jquery-3.5.1.min.js&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;"&lt;/span&gt;&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="token script language-javascript" style="box-sizing: border-box; display: initial;"&gt;&lt;/span&gt;&lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;lt;/&lt;/span&gt;script&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;lt;&lt;/span&gt;script&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="token script language-javascript" style="box-sizing: border-box; display: initial;"&gt;
&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;$&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;document&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;.&lt;/span&gt;&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;ready&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;function&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
    &lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;$&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token string" style="box-sizing: border-box; display: initial;"&gt;'.search-box input[type="text"]'&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;.&lt;/span&gt;&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;on&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token string" style="box-sizing: border-box; display: initial;"&gt;"keyup input"&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;,&lt;/span&gt; &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;function&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
        &lt;span class="token comment" style="box-sizing: border-box; display: none;"&gt;/* Get input value on change */&lt;/span&gt;
        &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;var&lt;/span&gt; inputVal &lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;=&lt;/span&gt; &lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;$&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;this&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;.&lt;/span&gt;&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;val&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
        &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;var&lt;/span&gt; resultDropdown &lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;=&lt;/span&gt; &lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;$&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;this&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;.&lt;/span&gt;&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;siblings&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token string" style="box-sizing: border-box; display: initial;"&gt;".result"&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
        &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;if&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;inputVal&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;.&lt;/span&gt;length&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
            $&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;.&lt;/span&gt;&lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;get&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token string" style="box-sizing: border-box; display: initial;"&gt;"backend-search.php"&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;,&lt;/span&gt; &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;term&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;:&lt;/span&gt; inputVal&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;.&lt;/span&gt;&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;done&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;function&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;data&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
                &lt;span class="token comment" style="box-sizing: border-box; display: none;"&gt;// Display the returned data in browser&lt;/span&gt;
                resultDropdown&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;.&lt;/span&gt;&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;html&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;data&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
            &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
        &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt; &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;else&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
            resultDropdown&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;.&lt;/span&gt;&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;empty&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
        &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt;
    &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
    
    &lt;span class="token comment" style="box-sizing: border-box; display: none;"&gt;// Set search input value on click of result item&lt;/span&gt;
    &lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;$&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;document&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;.&lt;/span&gt;&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;on&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token string" style="box-sizing: border-box; display: initial;"&gt;"click"&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;,&lt;/span&gt; &lt;span class="token string" style="box-sizing: border-box; display: initial;"&gt;".result p"&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;,&lt;/span&gt; &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;function&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
        &lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;$&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;this&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;.&lt;/span&gt;&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;parents&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token string" style="box-sizing: border-box; display: initial;"&gt;".search-box"&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;.&lt;/span&gt;&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;find&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token string" style="box-sizing: border-box; display: initial;"&gt;'input[type="text"]'&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;.&lt;/span&gt;&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;val&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;$&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;this&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;.&lt;/span&gt;&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;text&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
        &lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;$&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;this&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;.&lt;/span&gt;&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;parent&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token string" style="box-sizing: border-box; display: initial;"&gt;".result"&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;.&lt;/span&gt;&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;empty&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
    &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;lt;/&lt;/span&gt;script&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;lt;/&lt;/span&gt;head&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;lt;&lt;/span&gt;body&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class="token attr-name" style="box-sizing: border-box; display: initial;"&gt;class&lt;/span&gt;&lt;span class="token attr-value" style="box-sizing: border-box; display: initial;"&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;=&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;"&lt;/span&gt;search-box&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;"&lt;/span&gt;&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;lt;&lt;/span&gt;input&lt;/span&gt; &lt;span class="token attr-name" style="box-sizing: border-box; display: initial;"&gt;type&lt;/span&gt;&lt;span class="token attr-value" style="box-sizing: border-box; display: initial;"&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;=&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;"&lt;/span&gt;text&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;"&lt;/span&gt;&lt;/span&gt; &lt;span class="token attr-name" style="box-sizing: border-box; display: initial;"&gt;autocomplete&lt;/span&gt;&lt;span class="token attr-value" style="box-sizing: border-box; display: initial;"&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;=&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;"&lt;/span&gt;off&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;"&lt;/span&gt;&lt;/span&gt; &lt;span class="token attr-name" style="box-sizing: border-box; display: initial;"&gt;placeholder&lt;/span&gt;&lt;span class="token attr-value" style="box-sizing: border-box; display: initial;"&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;=&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;"&lt;/span&gt;Search country...&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;"&lt;/span&gt;&lt;/span&gt; &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class="token attr-name" style="box-sizing: border-box; display: initial;"&gt;class&lt;/span&gt;&lt;span class="token attr-value" style="box-sizing: border-box; display: initial;"&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;=&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;"&lt;/span&gt;result&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;"&lt;/span&gt;&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;lt;/&lt;/span&gt;body&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token tag" style="box-sizing: border-box; display: none;"&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;lt;/&lt;/span&gt;html&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line-numbers-sizer" style="box-sizing: border-box; display: initial;"&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;p style="background-color: white; box-sizing: border-box; color: #333333; font-family: Merriweather, serif; font-size: 17px;"&gt;Every time the content of search input is changed or keyup event occur on search input the jQuery code (&lt;i style="box-sizing: border-box;"&gt;line no-47 to 67&lt;/i&gt;) sent an Ajax request to the "backend-search.php" file which retrieves the records from&amp;nbsp;&lt;i style="box-sizing: border-box;"&gt;countries&lt;/i&gt;&amp;nbsp;table related to the searched term. Those records later will be inserted inside a&amp;nbsp;&lt;a href="https://www.tutorialrepublic.com/html-reference/html-div-tag.php" style="box-sizing: border-box; color: #27aae1;"&gt;&lt;code style="background-color: #e0e0e0; box-sizing: border-box;"&gt;&amp;lt;div&amp;gt;&lt;/code&gt;&lt;/a&gt;&amp;nbsp;by the jQuery and displayed on the browser.&lt;/p&gt;&lt;h3 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Merriweather, serif; font-size: 1.25em; line-height: 1.5;"&gt;Step 3: Processing Search Query in Backend&lt;/h3&gt;&lt;p style="background-color: white; box-sizing: border-box; color: #333333; font-family: Merriweather, serif; font-size: 17px;"&gt;And here's the source code of our "backend-search.php" file which searches the database based on query string sent by the Ajax request and send the results back to browser.&lt;/p&gt;&lt;div class="example" style="background-color: white; box-sizing: border-box; color: #333333; font-family: Merriweather, serif; font-size: 17px;"&gt;&lt;div class="codebox multi-style-mode" style="box-sizing: border-box;"&gt;&lt;div class="codebox-title" style="box-sizing: border-box;"&gt;&lt;h4 style="box-sizing: border-box;"&gt;Example&lt;/h4&gt;&lt;div class="code-style active" style="box-sizing: border-box;"&gt;&lt;span class="active" data-target="0" data-url="backend-search" style="box-sizing: border-box;" title="Show Example Code in Procedural Style"&gt;Procedural&lt;/span&gt;&amp;nbsp;&lt;span data-target="1" data-url="backend-search-oo-format" style="box-sizing: border-box;" title="Show Example Code in Object Oriented Style"&gt;Object Oriented&lt;/span&gt;&amp;nbsp;&lt;span data-target="2" data-url="backend-search-pdo-format" style="box-sizing: border-box;" title="Show Example Code in PDO Style"&gt;PDO&lt;/span&gt;&lt;/div&gt;&lt;a class="download-btn" href="https://www.tutorialrepublic.com/examples/bin/download-source.php?topic=php&amp;amp;file=backend-search" style="box-sizing: border-box; color: #27aae1;" target="_top" title="Download Source Code"&gt;&lt;span style="box-sizing: border-box;"&gt;Download&lt;/span&gt;&lt;/a&gt;&lt;span class="box-size" style="box-sizing: border-box;"&gt;&lt;i style="box-sizing: border-box;" title="Maximize"&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre class="syntax-highlighter line-numbers scroll xxlarge language-php" style="background-color: #e0e0e0; box-sizing: border-box; overflow: auto; padding: 10px;"&gt;&lt;code class="language-php" style="box-sizing: border-box; display: initial;"&gt;&lt;span class="token php language-php" style="box-sizing: border-box; display: initial;"&gt;&lt;span class="token delimiter important" style="box-sizing: border-box; display: initial;"&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class="token comment" style="box-sizing: border-box; display: none;"&gt;/* Attempt MySQL server connection. Assuming you are running MySQL
server with default setting (user 'root' with no password) */&lt;/span&gt;
&lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$link&lt;/span&gt; &lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;=&lt;/span&gt; &lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;mysqli_connect&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"localhost"&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;,&lt;/span&gt; &lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"root"&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;,&lt;/span&gt; &lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;""&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;,&lt;/span&gt; &lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"demo"&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
 
&lt;span class="token comment" style="box-sizing: border-box; display: none;"&gt;// Check connection&lt;/span&gt;
&lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;if&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$link&lt;/span&gt; &lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;===&lt;/span&gt; &lt;span class="token boolean" style="box-sizing: border-box; display: initial;"&gt;false&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
    &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;die&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"ERROR: Could not connect. "&lt;/span&gt; &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;.&lt;/span&gt; &lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;mysqli_connect_error&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt;
 
&lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;if&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;isset&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$_REQUEST&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;[&lt;/span&gt;&lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"term"&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;]&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
    &lt;span class="token comment" style="box-sizing: border-box; display: none;"&gt;// Prepare a select statement&lt;/span&gt;
    &lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$sql&lt;/span&gt; &lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;=&lt;/span&gt; &lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"SELECT * FROM countries WHERE name LIKE ?"&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
    
    &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;if&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$stmt&lt;/span&gt; &lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;=&lt;/span&gt; &lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;mysqli_prepare&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$link&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;,&lt;/span&gt; &lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$sql&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
        &lt;span class="token comment" style="box-sizing: border-box; display: none;"&gt;// Bind variables to the prepared statement as parameters&lt;/span&gt;
        &lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;mysqli_stmt_bind_param&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$stmt&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;,&lt;/span&gt; &lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"s"&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;,&lt;/span&gt; &lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$param_term&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
        
        &lt;span class="token comment" style="box-sizing: border-box; display: none;"&gt;// Set parameters&lt;/span&gt;
        &lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$param_term&lt;/span&gt; &lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;=&lt;/span&gt; &lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$_REQUEST&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;[&lt;/span&gt;&lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"term"&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;]&lt;/span&gt; &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;.&lt;/span&gt; &lt;span class="token single-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;'%'&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
        
        &lt;span class="token comment" style="box-sizing: border-box; display: none;"&gt;// Attempt to execute the prepared statement&lt;/span&gt;
        &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;if&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;mysqli_stmt_execute&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$stmt&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
            &lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$result&lt;/span&gt; &lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;=&lt;/span&gt; &lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;mysqli_stmt_get_result&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$stmt&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
            
            &lt;span class="token comment" style="box-sizing: border-box; display: none;"&gt;// Check number of rows in the result set&lt;/span&gt;
            &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;if&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;mysqli_num_rows&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$result&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt; &lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt; &lt;span class="token number" style="box-sizing: border-box; display: initial;"&gt;0&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
                &lt;span class="token comment" style="box-sizing: border-box; display: none;"&gt;// Fetch result rows as an associative array&lt;/span&gt;
                &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;while&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$row&lt;/span&gt; &lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;=&lt;/span&gt; &lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;mysqli_fetch_array&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$result&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;,&lt;/span&gt; &lt;span class="token constant" style="box-sizing: border-box; display: initial;"&gt;MYSQLI_ASSOC&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
                    &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;echo&lt;/span&gt; &lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"&amp;lt;p&amp;gt;"&lt;/span&gt; &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;.&lt;/span&gt; &lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$row&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;[&lt;/span&gt;&lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"name"&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;]&lt;/span&gt; &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;.&lt;/span&gt; &lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"&amp;lt;/p&amp;gt;"&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
                &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt;
            &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt; &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;else&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
                &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;echo&lt;/span&gt; &lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"&amp;lt;p&amp;gt;No matches found&amp;lt;/p&amp;gt;"&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
            &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt;
        &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt; &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;else&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
            &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;echo&lt;/span&gt; &lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"ERROR: Could not able to execute &lt;span class="token interpolation" style="box-sizing: border-box; display: initial;"&gt;&lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$sql&lt;/span&gt;&lt;/span&gt;. "&lt;/span&gt; &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;.&lt;/span&gt; &lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;mysqli_error&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$link&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
        &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt;
    &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt;
     
    &lt;span class="token comment" style="box-sizing: border-box; display: none;"&gt;// Close statement&lt;/span&gt;
    &lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;mysqli_stmt_close&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$stmt&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt;
 
&lt;span class="token comment" style="box-sizing: border-box; display: none;"&gt;// close connection&lt;/span&gt;
&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;mysqli_close&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$link&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
&lt;span class="token delimiter important" style="box-sizing: border-box; display: initial;"&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line-numbers-sizer" style="box-sizing: border-box; display: initial;"&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;pre class="syntax-highlighter line-numbers scroll xxlarge hide language-php" style="background-color: #e0e0e0; box-sizing: border-box; overflow: auto; padding: 10px;"&gt;&lt;code class="language-php" style="box-sizing: border-box; display: initial;"&gt;&lt;span class="token php language-php" style="box-sizing: border-box; display: initial;"&gt;&lt;span class="token delimiter important" style="box-sizing: border-box; display: initial;"&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class="token comment" style="box-sizing: border-box; display: none;"&gt;/* Attempt MySQL server connection. Assuming you are running MySQL
server with default setting (user 'root' with no password) */&lt;/span&gt;
&lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$mysqli&lt;/span&gt; &lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;=&lt;/span&gt; &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;new&lt;/span&gt; &lt;span class="token class-name" style="box-sizing: border-box; display: initial;"&gt;mysqli&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"localhost"&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;,&lt;/span&gt; &lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"root"&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;,&lt;/span&gt; &lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;""&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;,&lt;/span&gt; &lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"demo"&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
 
&lt;span class="token comment" style="box-sizing: border-box; display: none;"&gt;// Check connection&lt;/span&gt;
&lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;if&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$mysqli&lt;/span&gt; &lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;===&lt;/span&gt; &lt;span class="token boolean" style="box-sizing: border-box; display: initial;"&gt;false&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
    &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;die&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"ERROR: Could not connect. "&lt;/span&gt; &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;.&lt;/span&gt; &lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$mysqli&lt;/span&gt;&lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;-&lt;/span&gt;&lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="token property" style="box-sizing: border-box; display: initial;"&gt;connect_error&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt;
 
&lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;if&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;isset&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$_REQUEST&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;[&lt;/span&gt;&lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"term"&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;]&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
    &lt;span class="token comment" style="box-sizing: border-box; display: none;"&gt;// Prepare a select statement&lt;/span&gt;
    &lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$sql&lt;/span&gt; &lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;=&lt;/span&gt; &lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"SELECT * FROM countries WHERE name LIKE ?"&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
    
    &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;if&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$stmt&lt;/span&gt; &lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;=&lt;/span&gt; &lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$mysqli&lt;/span&gt;&lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;-&lt;/span&gt;&lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;prepare&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$sql&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
        &lt;span class="token comment" style="box-sizing: border-box; display: none;"&gt;// Bind variables to the prepared statement as parameters&lt;/span&gt;
        &lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$stmt&lt;/span&gt;&lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;-&lt;/span&gt;&lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;bind_param&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"s"&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;,&lt;/span&gt; &lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$param_term&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
        
        &lt;span class="token comment" style="box-sizing: border-box; display: none;"&gt;// Set parameters&lt;/span&gt;
        &lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$param_term&lt;/span&gt; &lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;=&lt;/span&gt; &lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$_REQUEST&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;[&lt;/span&gt;&lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"term"&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;]&lt;/span&gt; &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;.&lt;/span&gt; &lt;span class="token single-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;'%'&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
        
        &lt;span class="token comment" style="box-sizing: border-box; display: none;"&gt;// Attempt to execute the prepared statement&lt;/span&gt;
        &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;if&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$stmt&lt;/span&gt;&lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;-&lt;/span&gt;&lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;execute&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
            &lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$result&lt;/span&gt; &lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;=&lt;/span&gt; &lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$stmt&lt;/span&gt;&lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;-&lt;/span&gt;&lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;get_result&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
            
            &lt;span class="token comment" style="box-sizing: border-box; display: none;"&gt;// Check number of rows in the result set&lt;/span&gt;
            &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;if&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$result&lt;/span&gt;&lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;-&lt;/span&gt;&lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="token property" style="box-sizing: border-box; display: initial;"&gt;num_rows&lt;/span&gt; &lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt; &lt;span class="token number" style="box-sizing: border-box; display: initial;"&gt;0&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
                &lt;span class="token comment" style="box-sizing: border-box; display: none;"&gt;// Fetch result rows as an associative array&lt;/span&gt;
                &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;while&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$row&lt;/span&gt; &lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;=&lt;/span&gt; &lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$result&lt;/span&gt;&lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;-&lt;/span&gt;&lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;fetch_array&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token constant" style="box-sizing: border-box; display: initial;"&gt;MYSQLI_ASSOC&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
                    &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;echo&lt;/span&gt; &lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"&amp;lt;p&amp;gt;"&lt;/span&gt; &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;.&lt;/span&gt; &lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$row&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;[&lt;/span&gt;&lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"name"&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;]&lt;/span&gt; &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;.&lt;/span&gt; &lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"&amp;lt;/p&amp;gt;"&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
                &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt;
            &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt; &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;else&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
                &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;echo&lt;/span&gt; &lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"&amp;lt;p&amp;gt;No matches found&amp;lt;/p&amp;gt;"&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
            &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt;
        &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt; &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;else&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
            &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;echo&lt;/span&gt; &lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"ERROR: Could not able to execute &lt;span class="token interpolation" style="box-sizing: border-box; display: initial;"&gt;&lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$sql&lt;/span&gt;&lt;/span&gt;. "&lt;/span&gt; &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;.&lt;/span&gt; &lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;mysqli_error&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$link&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
        &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt;
    &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt;
     
    &lt;span class="token comment" style="box-sizing: border-box; display: none;"&gt;// Close statement&lt;/span&gt;
    &lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$stmt&lt;/span&gt;&lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;-&lt;/span&gt;&lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;close&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt;
 
&lt;span class="token comment" style="box-sizing: border-box; display: none;"&gt;// Close connection&lt;/span&gt;
&lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$mysqli&lt;/span&gt;&lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;-&lt;/span&gt;&lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;close&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
&lt;span class="token delimiter important" style="box-sizing: border-box; display: initial;"&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line-numbers-sizer" style="box-sizing: border-box; display: initial;"&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;pre class="syntax-highlighter line-numbers scroll xxlarge hide language-php" style="background-color: #e0e0e0; box-sizing: border-box; overflow: auto; padding: 10px;"&gt;&lt;code class="language-php" style="box-sizing: border-box; display: initial;"&gt;&lt;span class="token php language-php" style="box-sizing: border-box; display: initial;"&gt;&lt;span class="token delimiter important" style="box-sizing: border-box; display: initial;"&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class="token comment" style="box-sizing: border-box; display: none;"&gt;/* Attempt MySQL server connection. Assuming you are running MySQL
server with default setting (user 'root' with no password) */&lt;/span&gt;
&lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;try&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
    &lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$pdo&lt;/span&gt; &lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;=&lt;/span&gt; &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;new&lt;/span&gt; &lt;span class="token class-name" style="box-sizing: border-box; display: initial;"&gt;PDO&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"mysql:host=localhost;dbname=demo"&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;,&lt;/span&gt; &lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"root"&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;,&lt;/span&gt; &lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;""&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
    &lt;span class="token comment" style="box-sizing: border-box; display: none;"&gt;// Set the PDO error mode to exception&lt;/span&gt;
    &lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$pdo&lt;/span&gt;&lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;-&lt;/span&gt;&lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;setAttribute&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token constant" style="box-sizing: border-box; display: initial;"&gt;PDO&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;:&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;:&lt;/span&gt;&lt;span class="token constant" style="box-sizing: border-box; display: initial;"&gt;ATTR_ERRMODE&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;,&lt;/span&gt; &lt;span class="token constant" style="box-sizing: border-box; display: initial;"&gt;PDO&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;:&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;:&lt;/span&gt;&lt;span class="token constant" style="box-sizing: border-box; display: initial;"&gt;ERRMODE_EXCEPTION&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt; &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;catch&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;PDOException &lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$e&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
    &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;die&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"ERROR: Could not connect. "&lt;/span&gt; &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;.&lt;/span&gt; &lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$e&lt;/span&gt;&lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;-&lt;/span&gt;&lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;getMessage&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt;
 
&lt;span class="token comment" style="box-sizing: border-box; display: none;"&gt;// Attempt search query execution&lt;/span&gt;
&lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;try&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
    &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;if&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;isset&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$_REQUEST&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;[&lt;/span&gt;&lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"term"&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;]&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
        &lt;span class="token comment" style="box-sizing: border-box; display: none;"&gt;// create prepared statement&lt;/span&gt;
        &lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$sql&lt;/span&gt; &lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;=&lt;/span&gt; &lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"SELECT * FROM countries WHERE name LIKE :term"&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
        &lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$stmt&lt;/span&gt; &lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;=&lt;/span&gt; &lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$pdo&lt;/span&gt;&lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;-&lt;/span&gt;&lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;prepare&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$sql&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
        &lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$term&lt;/span&gt; &lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;=&lt;/span&gt; &lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$_REQUEST&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;[&lt;/span&gt;&lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"term"&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;]&lt;/span&gt; &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;.&lt;/span&gt; &lt;span class="token single-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;'%'&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
        &lt;span class="token comment" style="box-sizing: border-box; display: none;"&gt;// bind parameters to statement&lt;/span&gt;
        &lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$stmt&lt;/span&gt;&lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;-&lt;/span&gt;&lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;bindParam&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;":term"&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;,&lt;/span&gt; &lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$term&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
        &lt;span class="token comment" style="box-sizing: border-box; display: none;"&gt;// execute the prepared statement&lt;/span&gt;
        &lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$stmt&lt;/span&gt;&lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;-&lt;/span&gt;&lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;execute&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
        &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;if&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$stmt&lt;/span&gt;&lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;-&lt;/span&gt;&lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;rowCount&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt; &lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt; &lt;span class="token number" style="box-sizing: border-box; display: initial;"&gt;0&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
            &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;while&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$row&lt;/span&gt; &lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;=&lt;/span&gt; &lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$stmt&lt;/span&gt;&lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;-&lt;/span&gt;&lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;fetch&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
                &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;echo&lt;/span&gt; &lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"&amp;lt;p&amp;gt;"&lt;/span&gt; &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;.&lt;/span&gt; &lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$row&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;[&lt;/span&gt;&lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"name"&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;]&lt;/span&gt; &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;.&lt;/span&gt; &lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"&amp;lt;/p&amp;gt;"&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
            &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt;
        &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt; &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;else&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
            &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;echo&lt;/span&gt; &lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"&amp;lt;p&amp;gt;No matches found&amp;lt;/p&amp;gt;"&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
        &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt;
    &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt;  
&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt; &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;catch&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;PDOException &lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$e&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;{&lt;/span&gt;
    &lt;span class="token keyword" style="box-sizing: border-box; display: initial;"&gt;die&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token double-quoted-string string" style="box-sizing: border-box; display: initial;"&gt;"ERROR: Could not able to execute &lt;span class="token interpolation" style="box-sizing: border-box; display: initial;"&gt;&lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$sql&lt;/span&gt;&lt;/span&gt;. "&lt;/span&gt; &lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;.&lt;/span&gt; &lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$e&lt;/span&gt;&lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;-&lt;/span&gt;&lt;span class="token operator" style="box-sizing: border-box; display: initial;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;getMessage&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;}&lt;/span&gt;
 
&lt;span class="token comment" style="box-sizing: border-box; display: none;"&gt;// Close statement&lt;/span&gt;
&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;unset&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$stmt&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
 
&lt;span class="token comment" style="box-sizing: border-box; display: none;"&gt;// Close connection&lt;/span&gt;
&lt;span class="token function" style="box-sizing: border-box; display: initial;"&gt;unset&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;(&lt;/span&gt;&lt;span class="token variable" style="box-sizing: border-box; display: initial;"&gt;$pdo&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;)&lt;/span&gt;&lt;span class="token punctuation" style="box-sizing: border-box; display: initial;"&gt;;&lt;/span&gt;
&lt;span class="token delimiter important" style="box-sizing: border-box; display: initial;"&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line-numbers-sizer" style="box-sizing: border-box; display: initial;"&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;p style="background-color: white; box-sizing: border-box; color: #333333; font-family: Merriweather, serif; font-size: 17px;"&gt;The SQL&amp;nbsp;&lt;a href="https://www.tutorialrepublic.com/sql-tutorial/sql-select-statement.php" style="box-sizing: border-box; color: #27aae1;"&gt;&lt;code style="background-color: #e0e0e0; box-sizing: border-box;"&gt;SELECT&lt;/code&gt;&lt;/a&gt;&amp;nbsp;statement is used in combination with the&amp;nbsp;&lt;a href="https://www.tutorialrepublic.com/sql-tutorial/sql-like-operator.php" style="box-sizing: border-box; color: #27aae1;"&gt;&lt;code style="background-color: #e0e0e0; box-sizing: border-box;"&gt;LIKE&lt;/code&gt;&lt;/a&gt;&amp;nbsp;operator (&lt;i style="box-sizing: border-box;"&gt;line no-16&lt;/i&gt;) to find the matching records in&amp;nbsp;&lt;i style="box-sizing: border-box;"&gt;countries&lt;/i&gt;&amp;nbsp;database table. We've implemented the&amp;nbsp;&lt;a href="https://www.tutorialrepublic.com/php-tutorial/php-mysql-prepared-statements.php" style="box-sizing: border-box; color: #27aae1;"&gt;prepared statement&lt;/a&gt;&amp;nbsp;for better search performance as well as to prevent the&amp;nbsp;&lt;a href="https://www.tutorialrepublic.com/sql-tutorial/sql-injection.php" style="box-sizing: border-box; color: #27aae1;"&gt;SQL injection&lt;/a&gt;&amp;nbsp;attack.&lt;/p&gt;&lt;div class="color-box" style="background-color: white; box-sizing: border-box; color: #333333; font-family: Merriweather, serif; font-size: 17px;"&gt;&lt;div class="shadow" style="box-sizing: border-box;"&gt;&lt;div class="info-tab note-icon" style="box-sizing: border-box; width: 1em;" title="Important Notes"&gt;&lt;i style="box-sizing: border-box;"&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class="note-box" style="box-sizing: border-box;"&gt;&lt;p style="box-sizing: border-box;"&gt;&lt;strong style="box-sizing: border-box;"&gt;Note:&lt;/strong&gt;&amp;nbsp;Always filter and validate user input before using it in a SQL statement. You can also use PHP&amp;nbsp;&lt;code style="background-color: #e0e0e0; box-sizing: border-box;"&gt;mysqli_real_escape_string()&lt;/code&gt;&amp;nbsp;function to escape special characters in a user input and create a legal SQL string to protect against SQL injection.&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description><link>http://develovers.blogspot.com/2021/06/mysql-database-live-search-with-php-and.html</link><thr:total>0</thr:total><author>noreply@blogger.com (...:::HiToKiRi.rEd:::...)</author><enclosure length="1996" type="application/zip" url="https://www.tutorialrepublic.com/examples/downloads/countries-table.zip"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6184319049478717608.post-3342617699363656221</guid><pubDate>Thu, 22 Apr 2021 16:34:00 +0000</pubDate><atom:updated>2021-04-22T09:34:05.445-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">PHP</category><title>Import and Export CSV File using PHP and MySQL</title><description>&lt;p&gt;&amp;nbsp;&lt;span style="background-color: white; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px;"&gt;Import and Export feature is very useful for the data management section. The Import functionality allows the user to upload and insert multiple data in the database. Using the&lt;/span&gt;&lt;span style="background-color: white; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;b style="box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px;"&gt;Import&lt;/b&gt;&lt;span style="background-color: white; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px;"&gt;feature, the bulk data can be inserted in the database on a single click. The export functionality allows the user to download the table data list and save in a file for offline use. Using the&lt;/span&gt;&lt;span style="background-color: white; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;b style="box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px;"&gt;Export&lt;/b&gt;&lt;span style="background-color: white; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px;"&gt;feature, multiple records can be downloaded in a file format.&lt;/span&gt;&lt;/p&gt;&lt;p style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; line-height: 1.8em; margin: 0px 0px 10px;"&gt;Mostly, the CSV file format is used to import and export data in the web application.&amp;nbsp;&lt;b style="box-sizing: border-box;"&gt;CSV (comma-separated values)&lt;/b&gt;&amp;nbsp;file stores the data in plain text format and helps to move data between programs. The import and export functionality can be easily implemented with a CSV file using PHP and MySQL.&amp;nbsp;&lt;a href="https://www.codexworld.com/import-csv-file-data-into-mysql-database-php/" style="background: transparent; border-bottom: 1px solid rgb(255, 115, 97); box-sizing: border-box; color: #428bca; text-decoration-line: none;"&gt;Import CSV file data in database&lt;/a&gt;&amp;nbsp;/&amp;nbsp;&lt;a href="https://www.codexworld.com/export-data-to-csv-file-using-php-mysql/" style="background: transparent; border-bottom: 1px solid rgb(255, 115, 97); box-sizing: border-box; color: #428bca; text-decoration-line: none;"&gt;Export data to CSV&lt;/a&gt;&amp;nbsp;file both can be integrated with PHP and MySQL. In this tutorial, we will show you how to import and export CSV file data in database using PHP and MySQL.&lt;/p&gt;&lt;p style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; line-height: 1.8em; margin: 0px 0px 10px;"&gt;In the example&amp;nbsp;&lt;b style="box-sizing: border-box;"&gt;import and export script&lt;/b&gt;, the following functionality will be implemented.&lt;/p&gt;&lt;ul class="bullet_disk_list" style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 14px; list-style: none; margin-bottom: 10px; margin-top: 0px;"&gt;&lt;li style="box-sizing: border-box; font-size: 16px; line-height: 1.8em; list-style: disc; margin-top: 5px;"&gt;Fetch the member’s data from the database and listed in the webpage.&lt;/li&gt;&lt;li style="box-sizing: border-box; font-size: 16px; line-height: 1.8em; list-style: disc; margin-top: 5px;"&gt;Import CSV file data into MySQL database using PHP.&lt;/li&gt;&lt;li style="box-sizing: border-box; font-size: 16px; line-height: 1.8em; list-style: disc; margin-top: 5px;"&gt;Export data to CSV using PHP and MySQL.&lt;/li&gt;&lt;/ul&gt;&lt;h2 style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 20px; line-height: 1.2em; margin: 25px 0px 15px;"&gt;Create Database Table&lt;/h2&gt;&lt;p style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; line-height: 1.8em; margin: 0px 0px 10px;"&gt;To store the member’s data, a table needs to be created in the database. The following SQL creates a&amp;nbsp;&lt;code style="background-color: #eeeeee; border-radius: 2px; border: 1px solid rgb(228, 228, 228); box-sizing: border-box; color: #c7254e; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, serif; font-size: 0.875em; line-height: 1.85714em; padding: 2px 4px; white-space: pre-wrap;"&gt;members&lt;/code&gt;&amp;nbsp;table with some basic fields in the MySQL database.&lt;/p&gt;&lt;pre style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; font-family: Menlo, Monaco, Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 1.42857; margin-bottom: 10px; margin-top: 0px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; white-space: pre-wrap; word-break: break-all;"&gt;&lt;span class="hljs-keyword" style="box-sizing: border-box; color: #954121;"&gt;CREATE&lt;/span&gt; &lt;span class="hljs-keyword" style="box-sizing: border-box; color: #954121;"&gt;TABLE&lt;/span&gt; &lt;span class="hljs-string" style="box-sizing: border-box; color: #219161;"&gt;`members`&lt;/span&gt; (
 &lt;span class="hljs-string" style="box-sizing: border-box; color: #219161;"&gt;`id`&lt;/span&gt; &lt;span class="hljs-built_in" style="box-sizing: border-box; color: #0086b3;"&gt;int&lt;/span&gt;(&lt;span class="hljs-number" style="box-sizing: border-box; color: #40a070;"&gt;11&lt;/span&gt;) &lt;span class="hljs-keyword" style="box-sizing: border-box; color: #954121;"&gt;NOT&lt;/span&gt; &lt;span class="hljs-literal" style="box-sizing: border-box; color: #954121;"&gt;NULL&lt;/span&gt; AUTO_INCREMENT,
 &lt;span class="hljs-string" style="box-sizing: border-box; color: #219161;"&gt;`name`&lt;/span&gt; &lt;span class="hljs-built_in" style="box-sizing: border-box; color: #0086b3;"&gt;varchar&lt;/span&gt;(&lt;span class="hljs-number" style="box-sizing: border-box; color: #40a070;"&gt;50&lt;/span&gt;) &lt;span class="hljs-keyword" style="box-sizing: border-box; color: #954121;"&gt;COLLATE&lt;/span&gt; utf8_unicode_ci &lt;span class="hljs-keyword" style="box-sizing: border-box; color: #954121;"&gt;NOT&lt;/span&gt; &lt;span class="hljs-literal" style="box-sizing: border-box; color: #954121;"&gt;NULL&lt;/span&gt;,
 &lt;span class="hljs-string" style="box-sizing: border-box; color: #219161;"&gt;`email`&lt;/span&gt; &lt;span class="hljs-built_in" style="box-sizing: border-box; color: #0086b3;"&gt;varchar&lt;/span&gt;(&lt;span class="hljs-number" style="box-sizing: border-box; color: #40a070;"&gt;50&lt;/span&gt;) &lt;span class="hljs-keyword" style="box-sizing: border-box; color: #954121;"&gt;COLLATE&lt;/span&gt; utf8_unicode_ci &lt;span class="hljs-keyword" style="box-sizing: border-box; color: #954121;"&gt;NOT&lt;/span&gt; &lt;span class="hljs-literal" style="box-sizing: border-box; color: #954121;"&gt;NULL&lt;/span&gt;,
 &lt;span class="hljs-string" style="box-sizing: border-box; color: #219161;"&gt;`phone`&lt;/span&gt; &lt;span class="hljs-built_in" style="box-sizing: border-box; color: #0086b3;"&gt;varchar&lt;/span&gt;(&lt;span class="hljs-number" style="box-sizing: border-box; color: #40a070;"&gt;15&lt;/span&gt;) &lt;span class="hljs-keyword" style="box-sizing: border-box; color: #954121;"&gt;COLLATE&lt;/span&gt; utf8_unicode_ci &lt;span class="hljs-keyword" style="box-sizing: border-box; color: #954121;"&gt;NOT&lt;/span&gt; &lt;span class="hljs-literal" style="box-sizing: border-box; color: #954121;"&gt;NULL&lt;/span&gt;,
 &lt;span class="hljs-string" style="box-sizing: border-box; color: #219161;"&gt;`created`&lt;/span&gt; datetime &lt;span class="hljs-keyword" style="box-sizing: border-box; color: #954121;"&gt;NOT&lt;/span&gt; &lt;span class="hljs-literal" style="box-sizing: border-box; color: #954121;"&gt;NULL&lt;/span&gt;,
 &lt;span class="hljs-string" style="box-sizing: border-box; color: #219161;"&gt;`modified`&lt;/span&gt; datetime &lt;span class="hljs-keyword" style="box-sizing: border-box; color: #954121;"&gt;NOT&lt;/span&gt; &lt;span class="hljs-literal" style="box-sizing: border-box; color: #954121;"&gt;NULL&lt;/span&gt;,
 &lt;span class="hljs-string" style="box-sizing: border-box; color: #219161;"&gt;`status`&lt;/span&gt; enum(&lt;span class="hljs-string" style="box-sizing: border-box; color: #219161;"&gt;'Active'&lt;/span&gt;,&lt;span class="hljs-string" style="box-sizing: border-box; color: #219161;"&gt;'Inactive'&lt;/span&gt;) &lt;span class="hljs-keyword" style="box-sizing: border-box; color: #954121;"&gt;COLLATE&lt;/span&gt; utf8_unicode_ci &lt;span class="hljs-keyword" style="box-sizing: border-box; color: #954121;"&gt;NOT&lt;/span&gt; &lt;span class="hljs-literal" style="box-sizing: border-box; color: #954121;"&gt;NULL&lt;/span&gt; &lt;span class="hljs-keyword" style="box-sizing: border-box; color: #954121;"&gt;DEFAULT&lt;/span&gt; &lt;span class="hljs-string" style="box-sizing: border-box; color: #219161;"&gt;'Active'&lt;/span&gt;,
 PRIMARY &lt;span class="hljs-keyword" style="box-sizing: border-box; color: #954121;"&gt;KEY&lt;/span&gt; (&lt;span class="hljs-string" style="box-sizing: border-box; color: #219161;"&gt;`id`&lt;/span&gt;)
) &lt;span class="hljs-keyword" style="box-sizing: border-box; color: #954121;"&gt;ENGINE&lt;/span&gt;=&lt;span class="hljs-keyword" style="box-sizing: border-box; color: #954121;"&gt;InnoDB&lt;/span&gt; &lt;span class="hljs-keyword" style="box-sizing: border-box; color: #954121;"&gt;DEFAULT&lt;/span&gt; &lt;span class="hljs-keyword" style="box-sizing: border-box; color: #954121;"&gt;CHARSET&lt;/span&gt;=utf8 &lt;span class="hljs-keyword" style="box-sizing: border-box; color: #954121;"&gt;COLLATE&lt;/span&gt;=utf8_unicode_ci;&lt;/pre&gt;&lt;h2 style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 20px; line-height: 1.2em; margin: 25px 0px 15px;"&gt;CSV File Format&lt;/h2&gt;&lt;p style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; line-height: 1.8em; margin: 0px 0px 10px;"&gt;Based on the database table structure, the CSV file should have these fields – Name, Email, Phone, and Status. To&amp;nbsp;&lt;b style="box-sizing: border-box;"&gt;import CSV file data&lt;/b&gt;&amp;nbsp;in the database, the CSV file format will similar to the following screen.&lt;/p&gt;&lt;div class="img_center" style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 14px; margin-bottom: 15px; text-align: center;"&gt;&lt;img alt="php-import-data-mysql-csv-file-format-codexworld" class="alignnone size-full wp-image-3872" height="274" loading="lazy" sizes="(max-width: 991px) 100vw, 991px" src="https://www.codexworld.com/wp-content/uploads/2019/02/php-import-data-mysql-csv-file-format-codexworld.png" srcset="https://www.codexworld.com/wp-content/uploads/2019/02/php-import-data-mysql-csv-file-format-codexworld.png 991w, https://www.codexworld.com/wp-content/uploads/2019/02/php-import-data-mysql-csv-file-format-codexworld-300x83.png 300w, https://www.codexworld.com/wp-content/uploads/2019/02/php-import-data-mysql-csv-file-format-codexworld-768x212.png 768w, https://www.codexworld.com/wp-content/uploads/2019/02/php-import-data-mysql-csv-file-format-codexworld-200x55.png 200w, https://www.codexworld.com/wp-content/uploads/2019/02/php-import-data-mysql-csv-file-format-codexworld-346x96.png 346w" style="border: 0px; box-sizing: border-box; display: inline !important; height: auto; margin: 5px; max-width: 100%; vertical-align: middle;" width="991" /&gt;&lt;/div&gt;&lt;p style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; line-height: 1.8em; margin: 0px 0px 10px;"&gt;When the data&amp;nbsp;&lt;b style="box-sizing: border-box;"&gt;export to CSV&lt;/b&gt;&amp;nbsp;file, the downloaded format will look like the following screen.&lt;/p&gt;&lt;div class="img_center" style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 14px; margin-bottom: 15px; text-align: center;"&gt;&lt;img alt="php-export-data-to-csv-file-format-codexworld" class="alignnone size-large wp-image-3873" height="189" loading="lazy" sizes="(max-width: 960px) 100vw, 960px" src="https://www.codexworld.com/wp-content/uploads/2019/02/php-export-data-to-csv-file-format-codexworld-1024x202.png" srcset="https://www.codexworld.com/wp-content/uploads/2019/02/php-export-data-to-csv-file-format-codexworld-1024x202.png 1024w, https://www.codexworld.com/wp-content/uploads/2019/02/php-export-data-to-csv-file-format-codexworld-300x59.png 300w, https://www.codexworld.com/wp-content/uploads/2019/02/php-export-data-to-csv-file-format-codexworld-768x152.png 768w, https://www.codexworld.com/wp-content/uploads/2019/02/php-export-data-to-csv-file-format-codexworld-200x39.png 200w, https://www.codexworld.com/wp-content/uploads/2019/02/php-export-data-to-csv-file-format-codexworld-346x68.png 346w, https://www.codexworld.com/wp-content/uploads/2019/02/php-export-data-to-csv-file-format-codexworld.png 1221w" style="border: 0px; box-sizing: border-box; display: inline !important; height: auto; margin: 5px; max-width: 100%; vertical-align: middle;" width="960" /&gt;&lt;/div&gt;&lt;h2 style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 20px; line-height: 1.2em; margin: 25px 0px 15px;"&gt;Database Configuration (dbConfig.php)&lt;/h2&gt;&lt;p style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; line-height: 1.8em; margin: 0px 0px 10px;"&gt;The&amp;nbsp;&lt;code style="background-color: #eeeeee; border-radius: 2px; border: 1px solid rgb(228, 228, 228); box-sizing: border-box; color: #c7254e; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, serif; font-size: 0.875em; line-height: 1.85714em; padding: 2px 4px; white-space: pre-wrap;"&gt;dbConfig.php&lt;/code&gt;&amp;nbsp;is used to connect the database. Specify the database host (&lt;code style="background-color: #eeeeee; border-radius: 2px; border: 1px solid rgb(228, 228, 228); box-sizing: border-box; color: #c7254e; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, serif; font-size: 0.875em; line-height: 1.85714em; padding: 2px 4px; white-space: pre-wrap;"&gt;$dbHost&lt;/code&gt;), username (&lt;code style="background-color: #eeeeee; border-radius: 2px; border: 1px solid rgb(228, 228, 228); box-sizing: border-box; color: #c7254e; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, serif; font-size: 0.875em; line-height: 1.85714em; padding: 2px 4px; white-space: pre-wrap;"&gt;$dbUsername&lt;/code&gt;), password (&lt;code style="background-color: #eeeeee; border-radius: 2px; border: 1px solid rgb(228, 228, 228); box-sizing: border-box; color: #c7254e; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, serif; font-size: 0.875em; line-height: 1.85714em; padding: 2px 4px; white-space: pre-wrap;"&gt;$dbPassword&lt;/code&gt;), and name (&lt;code style="background-color: #eeeeee; border-radius: 2px; border: 1px solid rgb(228, 228, 228); box-sizing: border-box; color: #c7254e; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, serif; font-size: 0.875em; line-height: 1.85714em; padding: 2px 4px; white-space: pre-wrap;"&gt;$dbName&lt;/code&gt;) as per your MySQL database credentials.&lt;/p&gt;&lt;pre style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 1.42857; margin-bottom: 10px; margin-top: 0px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; white-space: pre-wrap; word-break: break-all;"&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;&amp;lt;?php
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Database&amp;nbsp;configuration
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$dbHost&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"localhost"&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;;
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$dbUsername&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"root"&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;;
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$dbPassword&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"root"&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;;
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$dbName&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"codexworld"&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;;

&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Create&amp;nbsp;database&amp;nbsp;connection
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$db&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;new&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;mysqli&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$dbHost&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$dbUsername&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$dbPassword&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$dbName&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;);

&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Check&amp;nbsp;connection
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;if&amp;nbsp;(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$db&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;connect_error&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;)&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;die(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"Connection&amp;nbsp;failed:&amp;nbsp;"&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$db&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;connect_error&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;);
}&lt;/span&gt;&lt;/pre&gt;&lt;h2 style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 20px; line-height: 1.2em; margin: 25px 0px 15px;"&gt;CSV File Upload and Download (index.php)&lt;/h2&gt;&lt;p style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; line-height: 1.8em; margin: 0px 0px 10px;"&gt;Initially, the member’s data is listed in the HTML table with import and export option.&lt;/p&gt;&lt;ul class="bullet_disk_list" style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 14px; list-style: none; margin-bottom: 10px; margin-top: 0px;"&gt;&lt;li style="box-sizing: border-box; font-size: 16px; line-height: 1.8em; list-style: disc; margin-top: 5px;"&gt;Existing members data are fetched from the database and listed in a tabular format.&lt;/li&gt;&lt;li style="box-sizing: border-box; font-size: 16px; line-height: 1.8em; list-style: disc; margin-top: 5px;"&gt;An&amp;nbsp;&lt;b style="box-sizing: border-box;"&gt;Import&lt;/b&gt;&amp;nbsp;button is placed at the top of the list.&lt;ul style="box-sizing: border-box; list-style: none; margin-bottom: 0px; margin-top: 0px;"&gt;&lt;li style="box-sizing: border-box; line-height: 1.8em; list-style: disc; margin-top: 5px;"&gt;By clicking the Import button, a CSV file upload form appears.&lt;/li&gt;&lt;li style="box-sizing: border-box; line-height: 1.8em; list-style: disc; margin-top: 5px;"&gt;On submission, the form is submitted to the&amp;nbsp;&lt;code style="background-color: #eeeeee; border-radius: 2px; border: 1px solid rgb(228, 228, 228); box-sizing: border-box; color: #c7254e; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, serif; font-size: 0.875em; line-height: 1.85714em; padding: 2px 4px; white-space: pre-wrap;"&gt;importData.php&lt;/code&gt;&amp;nbsp;file for importing the CSV file data to the database.&lt;/li&gt;&lt;li style="box-sizing: border-box; line-height: 1.8em; list-style: disc; margin-top: 5px;"&gt;&lt;b style="box-sizing: border-box;"&gt;formToggle()&lt;/b&gt;&amp;nbsp;– This JavaScript function is used to Show/Hide the CSV upload form and it triggered when the Import button is clicked.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li style="box-sizing: border-box; font-size: 16px; line-height: 1.8em; list-style: disc; margin-top: 5px;"&gt;If the CSV file import request already submitted, the status message is retrieved from the URL and the import status is displayed on the web page.&lt;/li&gt;&lt;li style="box-sizing: border-box; font-size: 16px; line-height: 1.8em; list-style: disc; margin-top: 5px;"&gt;An&amp;nbsp;&lt;b style="box-sizing: border-box;"&gt;Export&lt;/b&gt;&amp;nbsp;button is placed at the top of the list.&lt;ul style="box-sizing: border-box; list-style: none; margin-bottom: 0px; margin-top: 0px;"&gt;&lt;li style="box-sizing: border-box; line-height: 1.8em; list-style: disc; margin-top: 5px;"&gt;The Export link navigates to the&amp;nbsp;&lt;code style="background-color: #eeeeee; border-radius: 2px; border: 1px solid rgb(228, 228, 228); box-sizing: border-box; color: #c7254e; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, serif; font-size: 0.875em; line-height: 1.85714em; padding: 2px 4px; white-space: pre-wrap;"&gt;exportData.php&lt;/code&gt;&amp;nbsp;file for exporting table data to CSV file.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;pre style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 1.42857; margin-bottom: 10px; margin-top: 0px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; white-space: pre-wrap; word-break: break-all;"&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;&amp;lt;?php
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Load&amp;nbsp;the&amp;nbsp;database&amp;nbsp;configuration&amp;nbsp;file
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;include_once&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'dbConfig.php'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;;

&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Get&amp;nbsp;status&amp;nbsp;message
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;if(!empty(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$_GET&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;[&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'status'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;])){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;switch(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$_GET&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;[&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'status'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;]){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'succ'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$statusType&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'alert-success'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$statusMsg&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'Members&amp;nbsp;data&amp;nbsp;has&amp;nbsp;been&amp;nbsp;imported&amp;nbsp;successfully.'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'err'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$statusType&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'alert-danger'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$statusMsg&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'Some&amp;nbsp;problem&amp;nbsp;occurred,&amp;nbsp;please&amp;nbsp;try&amp;nbsp;again.'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'invalid_file'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$statusType&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'alert-danger'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$statusMsg&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'Please&amp;nbsp;upload&amp;nbsp;a&amp;nbsp;valid&amp;nbsp;CSV&amp;nbsp;file.'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;default:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$statusType&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;''&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$statusMsg&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;''&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
}
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;?&amp;gt;&lt;/span&gt;

&lt;span style="box-sizing: border-box; color: #5f5e4e;"&gt;&lt;span class="hljs-comment" style="box-sizing: border-box; color: #6c6b5a;"&gt;&amp;lt;!-- Display status message --&amp;gt;&lt;/span&gt;
&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;&amp;lt;?php&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;if(!empty(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$statusMsg&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;)){&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;?&amp;gt;&lt;/span&gt;
&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;div&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;class&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"col-xs-12"&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;div&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;class&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"alert &lt;span style="box-sizing: border-box; color: #0000bb;"&gt;&amp;lt;?php&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$statusType&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;?&amp;gt;&lt;/span&gt;"&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;&amp;lt;?php&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$statusMsg&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;?&amp;gt;&lt;/span&gt;&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;div&lt;/span&gt;&amp;gt;&lt;/span&gt;
&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;div&lt;/span&gt;&amp;gt;&lt;/span&gt;
&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;&amp;lt;?php&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;}&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;?&amp;gt;&lt;/span&gt;

&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;div&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;class&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"row"&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="hljs-comment" style="box-sizing: border-box; color: #6c6b5a;"&gt;&amp;lt;!-- Import &amp;amp; Export link --&amp;gt;&lt;/span&gt;
    &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;div&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;class&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"col-md-12 head"&lt;/span&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;div&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;class&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"float-right"&lt;/span&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;a&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;href&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"javascript:void(0);"&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;class&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"btn btn-success"&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;onclick&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"formToggle('importFrm');"&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;i&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;class&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"plus"&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;i&lt;/span&gt;&amp;gt;&lt;/span&gt; Import&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;a&lt;/span&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;a&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;href&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"exportData.php"&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;class&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"btn btn-primary"&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;i&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;class&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"exp"&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;i&lt;/span&gt;&amp;gt;&lt;/span&gt; Export&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;a&lt;/span&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;div&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;div&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="hljs-comment" style="box-sizing: border-box; color: #6c6b5a;"&gt;&amp;lt;!-- CSV file upload form --&amp;gt;&lt;/span&gt;
    &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;div&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;class&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"col-md-12"&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;id&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"importFrm"&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;style&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"display: none;"&lt;/span&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;form&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;action&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"importData.php"&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;method&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"post"&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;enctype&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"multipart/form-data"&lt;/span&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;input&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;type&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"file"&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;name&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"file"&lt;/span&gt; /&amp;gt;&lt;/span&gt;
            &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;input&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;type&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"submit"&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;class&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"btn btn-primary"&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;name&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"importSubmit"&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;value&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"IMPORT"&lt;/span&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;form&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;div&lt;/span&gt;&amp;gt;&lt;/span&gt;

    &lt;span class="hljs-comment" style="box-sizing: border-box; color: #6c6b5a;"&gt;&amp;lt;!-- Data list table --&amp;gt;&lt;/span&gt; 
    &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;table&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;class&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"table table-striped table-bordered"&lt;/span&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;thead&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;class&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"thead-dark"&lt;/span&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;tr&lt;/span&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;th&lt;/span&gt;&amp;gt;&lt;/span&gt;#ID&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;th&lt;/span&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;th&lt;/span&gt;&amp;gt;&lt;/span&gt;Name&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;th&lt;/span&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;th&lt;/span&gt;&amp;gt;&lt;/span&gt;Email&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;th&lt;/span&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;th&lt;/span&gt;&amp;gt;&lt;/span&gt;Phone&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;th&lt;/span&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;th&lt;/span&gt;&amp;gt;&lt;/span&gt;Status&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;th&lt;/span&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;tr&lt;/span&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;thead&lt;/span&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;tbody&lt;/span&gt;&amp;gt;&lt;/span&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;&amp;lt;?php
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Get&amp;nbsp;member&amp;nbsp;rows
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$result&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$db&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;query&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"SELECT&amp;nbsp;*&amp;nbsp;FROM&amp;nbsp;members&amp;nbsp;ORDER&amp;nbsp;BY&amp;nbsp;id&amp;nbsp;DESC"&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$result&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;num_rows&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;0&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$row&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$result&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;fetch_assoc&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;()){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;?&amp;gt;&lt;/span&gt;
            &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;tr&lt;/span&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;td&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;&amp;lt;?php&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$row&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;[&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'id'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;];&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;?&amp;gt;&lt;/span&gt;&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;td&lt;/span&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;td&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;&amp;lt;?php&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$row&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;[&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'name'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;];&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;?&amp;gt;&lt;/span&gt;&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;td&lt;/span&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;td&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;&amp;lt;?php&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$row&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;[&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'email'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;];&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;?&amp;gt;&lt;/span&gt;&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;td&lt;/span&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;td&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;&amp;lt;?php&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$row&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;[&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'phone'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;];&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;?&amp;gt;&lt;/span&gt;&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;td&lt;/span&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;td&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;&amp;lt;?php&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$row&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;[&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'status'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;];&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;?&amp;gt;&lt;/span&gt;&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;td&lt;/span&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;tr&lt;/span&gt;&amp;gt;&lt;/span&gt;
        &lt;span style="box-sizing: border-box; color: #0000bb;"&gt;&amp;lt;?php&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;}&amp;nbsp;}else{&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;?&amp;gt;&lt;/span&gt;
            &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;tr&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;td&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;colspan&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"5"&lt;/span&gt;&amp;gt;&lt;/span&gt;No member(s) found...&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;td&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;tr&lt;/span&gt;&amp;gt;&lt;/span&gt;
        &lt;span style="box-sizing: border-box; color: #0000bb;"&gt;&amp;lt;?php&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;}&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;?&amp;gt;&lt;/span&gt;
        &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;tbody&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;table&lt;/span&gt;&amp;gt;&lt;/span&gt;
&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;div&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;

&lt;span hljs-comment="" style="box-sizing: border-box; color: #5f5e4e;"&gt;&amp;lt;!-- Show/hide CSV upload form --&amp;gt;&lt;/span&gt;
&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;script&lt;/span&gt;&amp;gt;&lt;/span&gt;
&lt;span style="box-sizing: border-box; color: #6e6b5e;"&gt;&lt;span class="hljs-function" style="box-sizing: border-box;"&gt;&lt;span class="hljs-keyword" style="box-sizing: border-box; color: #b854d4;"&gt;function&lt;/span&gt; &lt;span class="hljs-title" style="box-sizing: border-box; color: #6684e1;"&gt;formToggle&lt;/span&gt;(&lt;span class="hljs-params" style="box-sizing: border-box; color: #b65611;"&gt;ID&lt;/span&gt;)&lt;/span&gt;{
    &lt;span class="hljs-keyword" style="box-sizing: border-box; color: #b854d4;"&gt;var&lt;/span&gt; element = &lt;span class="hljs-built_in" style="box-sizing: border-box; color: #b65611;"&gt;document&lt;/span&gt;.getElementById(ID);
    &lt;span class="hljs-keyword" style="box-sizing: border-box; color: #b854d4;"&gt;if&lt;/span&gt;(element.style.display === &lt;span class="hljs-string" style="box-sizing: border-box; color: #60ac39;"&gt;"none"&lt;/span&gt;){
        element.style.display = &lt;span class="hljs-string" style="box-sizing: border-box; color: #60ac39;"&gt;"block"&lt;/span&gt;;
    }&lt;span class="hljs-keyword" style="box-sizing: border-box; color: #b854d4;"&gt;else&lt;/span&gt;{
        element.style.display = &lt;span class="hljs-string" style="box-sizing: border-box; color: #60ac39;"&gt;"none"&lt;/span&gt;;
    }
}&lt;/span&gt;
&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;script&lt;/span&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;p style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; line-height: 1.8em; margin: 0px 0px 10px;"&gt;This example code uses&amp;nbsp;&lt;b style="box-sizing: border-box;"&gt;Bootstrap 4 library&lt;/b&gt;&amp;nbsp;to styling the HTML Table, Form, and Links. You can omit it to include if you don’t want to use Bootstrap structure. Otherwise, include the Bootstrap library file and custom stylesheet file (if any).&lt;/p&gt;&lt;pre style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #5f5e4e; font-family: Menlo, Monaco, Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 1.42857; margin-bottom: 10px; margin-top: 0px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; white-space: pre-wrap; word-break: break-all;"&gt;&lt;span class="hljs-comment" style="box-sizing: border-box; color: #6c6b5a;"&gt;&amp;lt;!-- Bootstrap library --&amp;gt;&lt;/span&gt;
&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;link&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;rel&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"stylesheet"&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;href&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"assets/bootstrap/bootstrap.min.css"&lt;/span&gt;&amp;gt;&lt;/span&gt;

&lt;span class="hljs-comment" style="box-sizing: border-box; color: #6c6b5a;"&gt;&amp;lt;!-- Stylesheet file --&amp;gt;&lt;/span&gt;
&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;link&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;rel&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"stylesheet"&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;href&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"assets/css/style.css"&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;h2 style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 20px; line-height: 1.2em; margin: 25px 0px 15px;"&gt;Import CSV Data to Database (importData.php)&lt;/h2&gt;&lt;p style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; line-height: 1.8em; margin: 0px 0px 10px;"&gt;The&amp;nbsp;&lt;code style="background-color: #eeeeee; border-radius: 2px; border: 1px solid rgb(228, 228, 228); box-sizing: border-box; color: #c7254e; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, serif; font-size: 0.875em; line-height: 1.85714em; padding: 2px 4px; white-space: pre-wrap;"&gt;importData.php&lt;/code&gt;&amp;nbsp;file handles the CSV file upload and data import process with PHP and MySQL.&lt;/p&gt;&lt;ul class="bullet_disk_list" style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 14px; list-style: none; margin-bottom: 10px; margin-top: 0px;"&gt;&lt;li style="box-sizing: border-box; font-size: 16px; line-height: 1.8em; list-style: disc; margin-top: 5px;"&gt;Validate the submitted file whether a valid CSV file.&lt;/li&gt;&lt;li style="box-sizing: border-box; font-size: 16px; line-height: 1.8em; list-style: disc; margin-top: 5px;"&gt;Check the CSV file upload status using PHP&amp;nbsp;&lt;b style="box-sizing: border-box;"&gt;is_uploaded_file()&lt;/b&gt;&amp;nbsp;function.&lt;/li&gt;&lt;li style="box-sizing: border-box; font-size: 16px; line-height: 1.8em; list-style: disc; margin-top: 5px;"&gt;Open the CSV file using PHP&amp;nbsp;&lt;b style="box-sizing: border-box;"&gt;fopen()&lt;/b&gt;&amp;nbsp;function.&lt;/li&gt;&lt;li style="box-sizing: border-box; font-size: 16px; line-height: 1.8em; list-style: disc; margin-top: 5px;"&gt;Parse data from the CSV file using PHP&amp;nbsp;&lt;b style="box-sizing: border-box;"&gt;fgetcsv()&lt;/b&gt;&amp;nbsp;function.&lt;/li&gt;&lt;li style="box-sizing: border-box; font-size: 16px; line-height: 1.8em; list-style: disc; margin-top: 5px;"&gt;Insert or Update data into the database based on the member’s email.&lt;/li&gt;&lt;/ul&gt;&lt;pre style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 1.42857; margin-bottom: 10px; margin-top: 0px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; white-space: pre-wrap; word-break: break-all;"&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;&amp;lt;?php
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Load&amp;nbsp;the&amp;nbsp;database&amp;nbsp;configuration&amp;nbsp;file
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;include_once&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'dbConfig.php'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;;

if(isset(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$_POST&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;[&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'importSubmit'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;])){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Allowed&amp;nbsp;mime&amp;nbsp;types
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$csvMimes&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;array(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'text/x-comma-separated-values'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'text/comma-separated-values'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'application/octet-stream'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'application/vnd.ms-excel'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'application/x-csv'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'text/x-csv'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'text/csv'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'application/csv'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'application/excel'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'application/vnd.msexcel'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'text/plain'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Validate&amp;nbsp;whether&amp;nbsp;selected&amp;nbsp;file&amp;nbsp;is&amp;nbsp;a&amp;nbsp;CSV&amp;nbsp;file
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;if(!empty(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$_FILES&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;[&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'file'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;][&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'name'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;])&amp;nbsp;&amp;amp;&amp;amp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;in_array&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$_FILES&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;[&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'file'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;][&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'type'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;],&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$csvMimes&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;)){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;If&amp;nbsp;the&amp;nbsp;file&amp;nbsp;is&amp;nbsp;uploaded
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;if(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;is_uploaded_file&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$_FILES&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;[&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'file'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;][&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'tmp_name'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;])){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Open&amp;nbsp;uploaded&amp;nbsp;CSV&amp;nbsp;file&amp;nbsp;with&amp;nbsp;read-only&amp;nbsp;mode
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$csvFile&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;fopen&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$_FILES&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;[&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'file'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;][&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'tmp_name'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;],&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'r'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Skip&amp;nbsp;the&amp;nbsp;first&amp;nbsp;line
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;fgetcsv&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$csvFile&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Parse&amp;nbsp;data&amp;nbsp;from&amp;nbsp;CSV&amp;nbsp;file&amp;nbsp;line&amp;nbsp;by&amp;nbsp;line
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;while((&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$line&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;fgetcsv&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$csvFile&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;))&amp;nbsp;!==&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;FALSE&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Get&amp;nbsp;row&amp;nbsp;data
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$name&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$line&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;[&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;0&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$email&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$line&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;[&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;1&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$phone&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$line&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;[&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;2&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$status&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$line&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;[&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;3&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Check&amp;nbsp;whether&amp;nbsp;member&amp;nbsp;already&amp;nbsp;exists&amp;nbsp;in&amp;nbsp;the&amp;nbsp;database&amp;nbsp;with&amp;nbsp;the&amp;nbsp;same&amp;nbsp;email
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$prevQuery&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"SELECT&amp;nbsp;id&amp;nbsp;FROM&amp;nbsp;members&amp;nbsp;WHERE&amp;nbsp;email&amp;nbsp;=&amp;nbsp;'"&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;.&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$line&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;[&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;1&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;].&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"'"&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$prevResult&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$db&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;query&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$prevQuery&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$prevResult&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;num_rows&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;0&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Update&amp;nbsp;member&amp;nbsp;data&amp;nbsp;in&amp;nbsp;the&amp;nbsp;database
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$db&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;query&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"UPDATE&amp;nbsp;members&amp;nbsp;SET&amp;nbsp;name&amp;nbsp;=&amp;nbsp;'"&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;.&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$name&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;.&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"',&amp;nbsp;phone&amp;nbsp;=&amp;nbsp;'"&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;.&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$phone&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;.&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"',&amp;nbsp;status&amp;nbsp;=&amp;nbsp;'"&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;.&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$status&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;.&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"',&amp;nbsp;modified&amp;nbsp;=&amp;nbsp;NOW()&amp;nbsp;WHERE&amp;nbsp;email&amp;nbsp;=&amp;nbsp;'"&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;.&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$email&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;.&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"'"&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}else{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Insert&amp;nbsp;member&amp;nbsp;data&amp;nbsp;in&amp;nbsp;the&amp;nbsp;database
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$db&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;query&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"INSERT&amp;nbsp;INTO&amp;nbsp;members&amp;nbsp;(name,&amp;nbsp;email,&amp;nbsp;phone,&amp;nbsp;created,&amp;nbsp;modified,&amp;nbsp;status)&amp;nbsp;VALUES&amp;nbsp;('"&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;.&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$name&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;.&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"',&amp;nbsp;'"&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;.&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$email&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;.&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"',&amp;nbsp;'"&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;.&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$phone&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;.&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"',&amp;nbsp;NOW(),&amp;nbsp;NOW(),&amp;nbsp;'"&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;.&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$status&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;.&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"')"&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Close&amp;nbsp;opened&amp;nbsp;CSV&amp;nbsp;file
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;fclose&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$csvFile&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$qstring&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'?status=succ'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}else{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$qstring&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'?status=err'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}else{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$qstring&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'?status=invalid_file'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
}

&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Redirect&amp;nbsp;to&amp;nbsp;the&amp;nbsp;listing&amp;nbsp;page
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;header&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"Location:&amp;nbsp;index.php"&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;.&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$qstring&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;);&lt;/span&gt;&lt;/pre&gt;&lt;h2 style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 20px; line-height: 1.2em; margin: 25px 0px 15px;"&gt;Export Data to CSV (exportData.php)&lt;/h2&gt;&lt;p style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; line-height: 1.8em; margin: 0px 0px 10px;"&gt;The exportData.php file handles the data export process using PHP and MySQL.&lt;/p&gt;&lt;ul class="bullet_disk_list" style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 14px; list-style: none; margin-bottom: 10px; margin-top: 0px;"&gt;&lt;li style="box-sizing: border-box; font-size: 16px; line-height: 1.8em; list-style: disc; margin-top: 5px;"&gt;Fetch the records from the database.&lt;/li&gt;&lt;li style="box-sizing: border-box; font-size: 16px; line-height: 1.8em; list-style: disc; margin-top: 5px;"&gt;Create and open a file with writing-only mode using PHP&amp;nbsp;&lt;b style="box-sizing: border-box;"&gt;fopen()&lt;/b&gt;&amp;nbsp;function.&lt;/li&gt;&lt;li style="box-sizing: border-box; font-size: 16px; line-height: 1.8em; list-style: disc; margin-top: 5px;"&gt;Set header columns, format as CSV and write it to the opened file using PHP&amp;nbsp;&lt;b style="box-sizing: border-box;"&gt;fputcsv()&lt;/b&gt;&amp;nbsp;function.&lt;/li&gt;&lt;li style="box-sizing: border-box; font-size: 16px; line-height: 1.8em; list-style: disc; margin-top: 5px;"&gt;Output data from the database, format as CSV and write it to file.&lt;/li&gt;&lt;li style="box-sizing: border-box; font-size: 16px; line-height: 1.8em; list-style: disc; margin-top: 5px;"&gt;Force browser to download data as CSV format in a file.&lt;/li&gt;&lt;/ul&gt;&lt;pre style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 1.42857; margin-bottom: 10px; margin-top: 0px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; white-space: pre-wrap; word-break: break-all;"&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;&amp;lt;?php 
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Load&amp;nbsp;the&amp;nbsp;database&amp;nbsp;configuration&amp;nbsp;file 
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;include_once&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'dbConfig.php'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;; 
 
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$filename&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"members_"&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;date&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'Y-m-d'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;)&amp;nbsp;.&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;".csv"&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;; 
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$delimiter&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;","&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;; 
 
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Create&amp;nbsp;a&amp;nbsp;file&amp;nbsp;pointer 
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$f&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;fopen&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'php://memory'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'w'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;); 
 
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Set&amp;nbsp;column&amp;nbsp;headers 
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$fields&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;array(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'ID'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'Name'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'Email'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'Phone'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'Created'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'Status'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;); 
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;fputcsv&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$f&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$fields&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$delimiter&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;); 
 
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Get&amp;nbsp;records&amp;nbsp;from&amp;nbsp;the&amp;nbsp;database 
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$result&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$db&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;query&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"SELECT&amp;nbsp;*&amp;nbsp;FROM&amp;nbsp;members&amp;nbsp;ORDER&amp;nbsp;BY&amp;nbsp;id&amp;nbsp;DESC"&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;); 
if(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$result&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;num_rows&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;0&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;){ 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Output&amp;nbsp;each&amp;nbsp;row&amp;nbsp;of&amp;nbsp;the&amp;nbsp;data,&amp;nbsp;format&amp;nbsp;line&amp;nbsp;as&amp;nbsp;csv&amp;nbsp;and&amp;nbsp;write&amp;nbsp;to&amp;nbsp;file&amp;nbsp;pointer 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;while(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$row&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$result&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;fetch_assoc&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;()){ 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$lineData&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;array(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$row&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;[&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'id'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;],&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$row&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;[&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'name'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;],&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$row&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;[&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'email'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;],&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$row&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;[&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'phone'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;],&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$row&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;[&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'created'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;],&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$row&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;[&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'status'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;]); 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;fputcsv&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$f&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$lineData&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$delimiter&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;); 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} 
} 
 
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Move&amp;nbsp;back&amp;nbsp;to&amp;nbsp;beginning&amp;nbsp;of&amp;nbsp;file 
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;fseek&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$f&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;0&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;); 
 
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Set&amp;nbsp;headers&amp;nbsp;to&amp;nbsp;download&amp;nbsp;file&amp;nbsp;rather&amp;nbsp;than&amp;nbsp;displayed 
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;header&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'Content-Type:&amp;nbsp;text/csv'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;); 
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;header&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'Content-Disposition:&amp;nbsp;attachment;&amp;nbsp;filename="'&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$filename&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'";'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;); 
 
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Output&amp;nbsp;all&amp;nbsp;remaining&amp;nbsp;data&amp;nbsp;on&amp;nbsp;a&amp;nbsp;file&amp;nbsp;pointer 
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;fpassthru&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$f&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;); 
 
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Exit&amp;nbsp;from&amp;nbsp;file 
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;exit();&lt;/span&gt;&lt;/pre&gt;&lt;p class="seeAlso" style="background-color: #f6f8f7; border-bottom: 0px; border-image: initial; border-left: 4px solid rgb(231, 76, 60) !important; border-right: 0px; border-top: 0px; box-sizing: border-box; color: #222222; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; font-weight: bold; line-height: 1.8em; margin: 0px 0px 10px; padding: 10px 27px;"&gt;&lt;span style="box-sizing: border-box; margin-right: 0.75em;"&gt;&lt;/span&gt;&lt;a href="https://www.codexworld.com/export-html-table-data-to-csv-using-javascript/" style="background: transparent; border-bottom: none; box-sizing: border-box; color: #336633; display: inline-block; margin-right: 10px; text-decoration-line: none;"&gt;Export HTML Table Data to CSV using JavaScript&lt;/a&gt;&lt;/p&gt;&lt;h2 style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 20px; line-height: 1.2em; margin: 25px 0px 15px;"&gt;Conclusion&lt;/h2&gt;&lt;p style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; line-height: 1.8em; margin: 0px 0px 10px;"&gt;Our example script helps you to easily add the import and export feature to the data list using PHP and MySQL. To make the data management section user-friendly, the export and import functionality is a great option. Also, you can enhance our&amp;nbsp;&lt;b style="box-sizing: border-box;"&gt;import CSV file&lt;/b&gt;&amp;nbsp;and&amp;nbsp;&lt;b style="box-sizing: border-box;"&gt;export data to CSV&lt;/b&gt;&amp;nbsp;script with PHP and MySQL as per your needs.&lt;/p&gt;</description><link>http://develovers.blogspot.com/2021/04/import-and-export-csv-file-using-php.html</link><thr:total>0</thr:total><author>noreply@blogger.com (...:::HiToKiRi.rEd:::...)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6184319049478717608.post-7179458427592571904</guid><pubDate>Thu, 22 Apr 2021 16:32:00 +0000</pubDate><atom:updated>2021-04-22T09:32:31.304-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">PHP</category><title>Save Content from WYSIWYG Editor using PHP and MySQL</title><description>&lt;p&gt;&amp;nbsp;&lt;span style="background-color: white; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px;"&gt;The&lt;/span&gt;&lt;span style="background-color: white; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;b style="box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px;"&gt;WYSIWYG editor&lt;/b&gt;&lt;span style="background-color: white; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px;"&gt;allows the user to insert the HTML formatted text in the input field. You can easily&lt;/span&gt;&lt;span style="background-color: white; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;a href="https://www.codexworld.com/add-wysiwyg-html-editor-to-textarea-website/" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-bottom: 1px solid rgb(255, 115, 97); box-sizing: border-box; color: #428bca; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; text-decoration-line: none;"&gt;add WYSIWYG HTML editor to textarea&lt;/a&gt;&lt;span style="background-color: white; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px;"&gt;using jQuery plugin. There are many jQuery plugins are available to add WYSIWYG editor to texarea. CKEditor and TinyMCE editor is the most popular plugin to add rich text editor on the web page.&lt;/span&gt;&lt;/p&gt;&lt;p style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; line-height: 1.8em; margin: 0px 0px 10px;"&gt;Once the&amp;nbsp;&lt;b style="box-sizing: border-box;"&gt;WYSIWYG editor content&lt;/b&gt;&amp;nbsp;is submitted, the value needs to be stored for later use. Generally, in the web application, the database is used to store the input content. To save the WYSIWYG editor content, the input HTML value needs to be inserted in the database.&amp;nbsp;&lt;b style="box-sizing: border-box;"&gt;PHP $_POST method&lt;/b&gt;&amp;nbsp;is the easiest way to get HTML editor value and save WYSIWYG Editor content in the database. In this tutorial, we will show you how to insert and&amp;nbsp;&lt;b style="box-sizing: border-box;"&gt;save HTML content of WYSIWYG editor in the database&lt;/b&gt;&amp;nbsp;using PHP and MySQL.&lt;/p&gt;&lt;h2 style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 20px; line-height: 1.2em; margin: 25px 0px 15px;"&gt;Create Database Table&lt;/h2&gt;&lt;p style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; line-height: 1.8em; margin: 0px 0px 10px;"&gt;To store the HTML editor content, a table needs to be created in the database. The following SQL creates an&amp;nbsp;&lt;code style="background-color: #eeeeee; border-radius: 2px; border: 1px solid rgb(228, 228, 228); box-sizing: border-box; color: #c7254e; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, serif; font-size: 0.875em; line-height: 1.85714em; padding: 2px 4px; white-space: pre-wrap;"&gt;editor&lt;/code&gt;&amp;nbsp;table with some basic fields in the MySQL database.&lt;/p&gt;&lt;pre style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; font-family: Menlo, Monaco, Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 1.42857; margin-bottom: 10px; margin-top: 0px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; white-space: pre-wrap; word-break: break-all;"&gt;&lt;span class="hljs-keyword" style="box-sizing: border-box; color: #954121;"&gt;CREATE&lt;/span&gt; &lt;span class="hljs-keyword" style="box-sizing: border-box; color: #954121;"&gt;TABLE&lt;/span&gt; &lt;span class="hljs-string" style="box-sizing: border-box; color: #219161;"&gt;`editor`&lt;/span&gt; (
 &lt;span class="hljs-string" style="box-sizing: border-box; color: #219161;"&gt;`id`&lt;/span&gt; &lt;span class="hljs-built_in" style="box-sizing: border-box; color: #0086b3;"&gt;int&lt;/span&gt;(&lt;span class="hljs-number" style="box-sizing: border-box; color: #40a070;"&gt;11&lt;/span&gt;) &lt;span class="hljs-keyword" style="box-sizing: border-box; color: #954121;"&gt;NOT&lt;/span&gt; &lt;span class="hljs-literal" style="box-sizing: border-box; color: #954121;"&gt;NULL&lt;/span&gt; AUTO_INCREMENT,
 &lt;span class="hljs-string" style="box-sizing: border-box; color: #219161;"&gt;`content`&lt;/span&gt; &lt;span class="hljs-built_in" style="box-sizing: border-box; color: #0086b3;"&gt;text&lt;/span&gt; &lt;span class="hljs-keyword" style="box-sizing: border-box; color: #954121;"&gt;COLLATE&lt;/span&gt; utf8_unicode_ci &lt;span class="hljs-keyword" style="box-sizing: border-box; color: #954121;"&gt;NOT&lt;/span&gt; &lt;span class="hljs-literal" style="box-sizing: border-box; color: #954121;"&gt;NULL&lt;/span&gt;,
 &lt;span class="hljs-string" style="box-sizing: border-box; color: #219161;"&gt;`created`&lt;/span&gt; datetime &lt;span class="hljs-keyword" style="box-sizing: border-box; color: #954121;"&gt;NOT&lt;/span&gt; &lt;span class="hljs-literal" style="box-sizing: border-box; color: #954121;"&gt;NULL&lt;/span&gt;,
 PRIMARY &lt;span class="hljs-keyword" style="box-sizing: border-box; color: #954121;"&gt;KEY&lt;/span&gt; (&lt;span class="hljs-string" style="box-sizing: border-box; color: #219161;"&gt;`id`&lt;/span&gt;)
) &lt;span class="hljs-keyword" style="box-sizing: border-box; color: #954121;"&gt;ENGINE&lt;/span&gt;=&lt;span class="hljs-keyword" style="box-sizing: border-box; color: #954121;"&gt;InnoDB&lt;/span&gt; &lt;span class="hljs-keyword" style="box-sizing: border-box; color: #954121;"&gt;DEFAULT&lt;/span&gt; &lt;span class="hljs-keyword" style="box-sizing: border-box; color: #954121;"&gt;CHARSET&lt;/span&gt;=utf8 &lt;span class="hljs-keyword" style="box-sizing: border-box; color: #954121;"&gt;COLLATE&lt;/span&gt;=utf8_unicode_ci;&lt;/pre&gt;&lt;p class="seeAlso" style="background-color: #f6f8f7; border-bottom: 0px; border-image: initial; border-left: 4px solid rgb(231, 76, 60) !important; border-right: 0px; border-top: 0px; box-sizing: border-box; color: #222222; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; font-weight: bold; line-height: 1.8em; margin: 0px 0px 10px; padding: 10px 27px;"&gt;&lt;span style="box-sizing: border-box; margin-right: 0.75em;"&gt;&lt;/span&gt;&lt;a href="https://www.codexworld.com/add-wysiwyg-html-editor-to-textarea-ckeditor/" style="background: transparent; border-bottom: none; box-sizing: border-box; color: #336633; display: inline-block; margin-right: 10px; text-decoration-line: none;"&gt;Add WYSIWYG HTML Editor to Textarea with CKEditor&lt;/a&gt;&lt;/p&gt;&lt;h2 style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 20px; line-height: 1.2em; margin: 25px 0px 15px;"&gt;Database Configuration (dbConfig.php)&lt;/h2&gt;&lt;p style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; line-height: 1.8em; margin: 0px 0px 10px;"&gt;The&amp;nbsp;&lt;code style="background-color: #eeeeee; border-radius: 2px; border: 1px solid rgb(228, 228, 228); box-sizing: border-box; color: #c7254e; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, serif; font-size: 0.875em; line-height: 1.85714em; padding: 2px 4px; white-space: pre-wrap;"&gt;dbConfig.php&lt;/code&gt;&amp;nbsp;file is used to connect the database using PHP and MySQL. Specify the database host (&lt;code style="background-color: #eeeeee; border-radius: 2px; border: 1px solid rgb(228, 228, 228); box-sizing: border-box; color: #c7254e; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, serif; font-size: 0.875em; line-height: 1.85714em; padding: 2px 4px; white-space: pre-wrap;"&gt;$dbHost&lt;/code&gt;), username (&lt;code style="background-color: #eeeeee; border-radius: 2px; border: 1px solid rgb(228, 228, 228); box-sizing: border-box; color: #c7254e; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, serif; font-size: 0.875em; line-height: 1.85714em; padding: 2px 4px; white-space: pre-wrap;"&gt;$dbUsername&lt;/code&gt;), password (&lt;code style="background-color: #eeeeee; border-radius: 2px; border: 1px solid rgb(228, 228, 228); box-sizing: border-box; color: #c7254e; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, serif; font-size: 0.875em; line-height: 1.85714em; padding: 2px 4px; white-space: pre-wrap;"&gt;$dbPassword&lt;/code&gt;), and name (&lt;code style="background-color: #eeeeee; border-radius: 2px; border: 1px solid rgb(228, 228, 228); box-sizing: border-box; color: #c7254e; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, serif; font-size: 0.875em; line-height: 1.85714em; padding: 2px 4px; white-space: pre-wrap;"&gt;$dbName&lt;/code&gt;) as per your database credentials.&lt;/p&gt;&lt;pre style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 1.42857; margin-bottom: 10px; margin-top: 0px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; white-space: pre-wrap; word-break: break-all;"&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;&amp;lt;?php
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Database&amp;nbsp;configuration
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$dbHost&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"localhost"&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;;
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$dbUsername&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"root"&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;;
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$dbPassword&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"root"&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;;
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$dbName&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"codexworld"&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;;

&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Create&amp;nbsp;database&amp;nbsp;connection
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$db&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;new&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;mysqli&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$dbHost&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$dbUsername&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$dbPassword&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$dbName&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;);

&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Check&amp;nbsp;connection
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;if&amp;nbsp;(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$db&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;connect_error&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;)&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;die(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"Connection&amp;nbsp;failed:&amp;nbsp;"&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$db&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;connect_error&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;);
}&lt;/span&gt;&lt;/pre&gt;&lt;h2 style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 20px; line-height: 1.2em; margin: 25px 0px 15px;"&gt;WYSIWYG HTML Editor Form&lt;/h2&gt;&lt;p style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; line-height: 1.8em; margin: 0px 0px 10px;"&gt;At first, create an HTML form with textarea input field to allow the user to add content and submit data.&lt;/p&gt;&lt;pre style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #5f5e4e; font-family: Menlo, Monaco, Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 1.42857; margin-bottom: 10px; margin-top: 0px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; white-space: pre-wrap; word-break: break-all;"&gt;&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;form&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;method&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"post"&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;action&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"submit.php"&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;textarea&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;name&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"editor"&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;id&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"editor"&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;rows&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"10"&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;cols&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"80"&lt;/span&gt;&amp;gt;&lt;/span&gt;
    This is my textarea to be replaced with HTML editor.
    &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;textarea&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;input&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;type&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"submit"&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;name&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"submit"&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;value&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"SUBMIT"&lt;/span&gt;&amp;gt;&lt;/span&gt;
&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;form&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;p style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; line-height: 1.8em; margin: 0px 0px 10px;"&gt;To accept HTML content from the user, the textarea element needs to be converted in WYSIWYG Editor. You can use any WYSIWYG editor plugin (CKEditor or TinyMCE) to add HTML editor to textarea input field.&lt;br style="box-sizing: border-box;" /&gt;&lt;b style="box-sizing: border-box;"&gt;Add WYSIWYG editor with CKEditor:&lt;/b&gt;&lt;br style="box-sizing: border-box;" /&gt;Include the JS library file of CKEditor plugin.&lt;/p&gt;&lt;pre style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #5f5e4e; font-family: Menlo, Monaco, Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 1.42857; margin-bottom: 10px; margin-top: 0px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; white-space: pre-wrap; word-break: break-all;"&gt;&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;script&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;src&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"ckeditor/ckeditor.js"&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;span class="undefined" style="box-sizing: border-box;"&gt;&lt;/span&gt;&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;script&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;p style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; line-height: 1.8em; margin: 0px 0px 10px;"&gt;Use&amp;nbsp;&lt;code style="background-color: #eeeeee; border-radius: 2px; border: 1px solid rgb(228, 228, 228); box-sizing: border-box; color: #c7254e; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, serif; font-size: 0.875em; line-height: 1.85714em; padding: 2px 4px; white-space: pre-wrap;"&gt;CKEDITOR.replace()&lt;/code&gt;&amp;nbsp;method to replace the textarea field with WYSIWYG editor.&lt;/p&gt;&lt;pre style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #5f5e4e; font-family: Menlo, Monaco, Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 1.42857; margin-bottom: 10px; margin-top: 0px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; white-space: pre-wrap; word-break: break-all;"&gt;&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;script&lt;/span&gt;&amp;gt;&lt;/span&gt;
&lt;span style="box-sizing: border-box; color: #6e6b5e;"&gt;CKEDITOR.replace(&lt;span class="hljs-string" style="box-sizing: border-box; color: #60ac39;"&gt;'editor'&lt;/span&gt;);&lt;/span&gt;
&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;script&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;p style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; line-height: 1.8em; margin: 0px 0px 10px;"&gt;&lt;b style="box-sizing: border-box;"&gt;Add WYSIWYG editor with TinyMCE:&lt;/b&gt;&lt;br style="box-sizing: border-box;" /&gt;Include the JS library file of TinyMCE editor plugin.&lt;/p&gt;&lt;pre style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #5f5e4e; font-family: Menlo, Monaco, Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 1.42857; margin-bottom: 10px; margin-top: 0px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; white-space: pre-wrap; word-break: break-all;"&gt;&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;script&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;src&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"tinymce/tinymce.min.js"&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;span class="undefined" style="box-sizing: border-box;"&gt;&lt;/span&gt;&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;script&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;p style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; line-height: 1.8em; margin: 0px 0px 10px;"&gt;Use&amp;nbsp;&lt;code style="background-color: #eeeeee; border-radius: 2px; border: 1px solid rgb(228, 228, 228); box-sizing: border-box; color: #c7254e; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, serif; font-size: 0.875em; line-height: 1.85714em; padding: 2px 4px; white-space: pre-wrap;"&gt;tinymce.init()&lt;/code&gt;&amp;nbsp;method to replace the textarea field with WYSIWYG editor.&lt;/p&gt;&lt;pre style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #5f5e4e; font-family: Menlo, Monaco, Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 1.42857; margin-bottom: 10px; margin-top: 0px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; white-space: pre-wrap; word-break: break-all;"&gt;&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;script&lt;/span&gt;&amp;gt;&lt;/span&gt;
&lt;span style="box-sizing: border-box; color: #6e6b5e;"&gt;tinymce.init({
    selector: &lt;span class="hljs-string" style="box-sizing: border-box; color: #60ac39;"&gt;'#editor'&lt;/span&gt;
});&lt;/span&gt;
&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;script&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;h2 style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 20px; line-height: 1.2em; margin: 25px 0px 15px;"&gt;Save HTML Editor Content in the Database&lt;/h2&gt;&lt;p style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; line-height: 1.8em; margin: 0px 0px 10px;"&gt;Once the form is submitted, the editor’s content is posted to the server-side script (&lt;code style="background-color: #eeeeee; border-radius: 2px; border: 1px solid rgb(228, 228, 228); box-sizing: border-box; color: #c7254e; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, serif; font-size: 0.875em; line-height: 1.85714em; padding: 2px 4px; white-space: pre-wrap;"&gt;submit.php&lt;/code&gt;) for inserting the HTML formatted content in the database.&lt;/p&gt;&lt;ul class="bullet_disk_list" style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 14px; list-style: none; margin-bottom: 10px; margin-top: 0px;"&gt;&lt;li style="box-sizing: border-box; font-size: 16px; line-height: 1.8em; list-style: disc; margin-top: 5px;"&gt;Retrieve the editor content from the posted form data using the&amp;nbsp;&lt;b style="box-sizing: border-box;"&gt;$_POST method in PHP&lt;/b&gt;.&lt;/li&gt;&lt;li style="box-sizing: border-box; font-size: 16px; line-height: 1.8em; list-style: disc; margin-top: 5px;"&gt;Insert the HTML content in the database using PHP and MySQL.&lt;/li&gt;&lt;li style="box-sizing: border-box; font-size: 16px; line-height: 1.8em; list-style: disc; margin-top: 5px;"&gt;Display the status message to the user.&lt;/li&gt;&lt;/ul&gt;&lt;pre style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 1.42857; margin-bottom: 10px; margin-top: 0px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; white-space: pre-wrap; word-break: break-all;"&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;&amp;lt;?php
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Include&amp;nbsp;the&amp;nbsp;database&amp;nbsp;configuration&amp;nbsp;file
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;require_once&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'dbConfig.php'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;;

&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$editorContent&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$statusMsg&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;''&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;;

&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;If&amp;nbsp;the&amp;nbsp;form&amp;nbsp;is&amp;nbsp;submitted
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;if(isset(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$_POST&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;[&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'submit'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;])){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Get&amp;nbsp;editor&amp;nbsp;content
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$editorContent&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$_POST&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;[&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'editor'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Check&amp;nbsp;whether&amp;nbsp;the&amp;nbsp;editor&amp;nbsp;content&amp;nbsp;is&amp;nbsp;empty
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;if(!empty(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$editorContent&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;)){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Insert&amp;nbsp;editor&amp;nbsp;content&amp;nbsp;in&amp;nbsp;the&amp;nbsp;database
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$insert&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$db&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;query&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"INSERT&amp;nbsp;INTO&amp;nbsp;editor&amp;nbsp;(content,&amp;nbsp;created)&amp;nbsp;VALUES&amp;nbsp;('"&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;.&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$editorContent&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;.&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"',&amp;nbsp;NOW())"&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;If&amp;nbsp;database&amp;nbsp;insertion&amp;nbsp;is&amp;nbsp;successful
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;if(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$insert&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$statusMsg&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"The&amp;nbsp;editor&amp;nbsp;content&amp;nbsp;has&amp;nbsp;been&amp;nbsp;inserted&amp;nbsp;successfully."&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}else{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$statusMsg&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"Some&amp;nbsp;problem&amp;nbsp;occurred,&amp;nbsp;please&amp;nbsp;try&amp;nbsp;again."&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}else{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$statusMsg&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'Please&amp;nbsp;add&amp;nbsp;content&amp;nbsp;in&amp;nbsp;the&amp;nbsp;editor.'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
}
&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;?&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;h2 style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 20px; line-height: 1.2em; margin: 25px 0px 15px;"&gt;Conclusion&lt;/h2&gt;&lt;p style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; line-height: 1.8em; margin: 0px 0px 10px;"&gt;Not only the CKEditor and TinyMCE editor content, but you can also use the example code to insert any HTML editor content in the database. This code snippet is very useful for the CRUD application where the WYSIWYG editor is used for insert HTML content. You can easily enhance our script functionality to add additional input fields with WYSIWYG editor and save all the content in the database using PHP and MySQL.&lt;/p&gt;</description><link>http://develovers.blogspot.com/2021/04/save-content-from-wysiwyg-editor-using.html</link><thr:total>0</thr:total><author>noreply@blogger.com (...:::HiToKiRi.rEd:::...)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6184319049478717608.post-1783942169741520395</guid><pubDate>Thu, 22 Apr 2021 16:23:00 +0000</pubDate><atom:updated>2021-04-22T09:23:05.337-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">PHP</category><title>Compress Image Before Upload using PHP</title><description>&lt;p&gt;&amp;nbsp;&lt;span style="background-color: white; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px;"&gt;The large size image takes more time to load a web page. If you want to load a large image without affecting the page load time, the image needs to be optimized to reduce the size. Image compression is very helpful to reduce the size of the image. Generally, the user does not optimize the image when uploading through the website. In this case,&lt;/span&gt;&lt;span style="background-color: white; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;b style="box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px;"&gt;compress image before upload&lt;/b&gt;&lt;span style="background-color: white; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px;"&gt;to optimize the image.&lt;/span&gt;&lt;/p&gt;&lt;p style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; line-height: 1.8em; margin: 0px 0px 10px;"&gt;Compress/optimize image before upload can be easily implemented using PHP. In the&amp;nbsp;&lt;b style="box-sizing: border-box;"&gt;image compress&lt;/b&gt;&amp;nbsp;functionality, the file size is reduced before upload. The compressed image helps to reduce the uses of the server’s storage and load the web page faster. In this tutorial, we will show you how to&amp;nbsp;&lt;b style="box-sizing: border-box;"&gt;compress image before upload using PHP&lt;/b&gt;.&lt;/p&gt;&lt;h2 style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 20px; line-height: 1.2em; margin: 25px 0px 15px;"&gt;File Upload Form&lt;/h2&gt;&lt;p style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; line-height: 1.8em; margin: 0px 0px 10px;"&gt;Create an HTML form with a file input field and a submit button. Make sure the&amp;nbsp;&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;form&lt;/span&gt;&amp;gt;&lt;/span&gt;&amp;nbsp;tag contains the following attributes.&lt;/p&gt;&lt;ul class="bullet_disk_list" style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 14px; list-style: none; margin-bottom: 10px; margin-top: 0px;"&gt;&lt;li style="box-sizing: border-box; font-size: 16px; line-height: 1.8em; list-style: disc; margin-top: 5px;"&gt;&lt;code style="background-color: #eeeeee; border-radius: 2px; border: 1px solid rgb(228, 228, 228); box-sizing: border-box; color: #c7254e; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, serif; font-size: 0.875em; line-height: 1.85714em; padding: 2px 4px; white-space: pre-wrap;"&gt;method="post"&lt;/code&gt;&lt;/li&gt;&lt;li style="box-sizing: border-box; font-size: 16px; line-height: 1.8em; list-style: disc; margin-top: 5px;"&gt;&lt;code style="background-color: #eeeeee; border-radius: 2px; border: 1px solid rgb(228, 228, 228); box-sizing: border-box; color: #c7254e; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, serif; font-size: 0.875em; line-height: 1.85714em; padding: 2px 4px; white-space: pre-wrap;"&gt;enctype="multipart/form-data"&lt;/code&gt;&lt;/li&gt;&lt;/ul&gt;&lt;pre style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #5f5e4e; font-family: Menlo, Monaco, Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 1.42857; margin-bottom: 10px; margin-top: 0px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; white-space: pre-wrap; word-break: break-all;"&gt;&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;form&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;action&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"upload.php"&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;method&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"post"&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;enctype&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"multipart/form-data"&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;label&lt;/span&gt;&amp;gt;&lt;/span&gt;Select Image File:&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;label&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;input&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;type&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"file"&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;name&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"image"&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;input&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;type&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"submit"&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;name&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"submit"&lt;/span&gt; &lt;span class="hljs-attr" style="box-sizing: border-box;"&gt;value&lt;/span&gt;=&lt;span class="hljs-string" style="box-sizing: border-box; color: #7d9726;"&gt;"Upload"&lt;/span&gt;&amp;gt;&lt;/span&gt;
&lt;span class="hljs-tag" style="box-sizing: border-box; color: #ba6236;"&gt;&amp;lt;/&lt;span class="hljs-name" style="box-sizing: border-box;"&gt;form&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;p style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; line-height: 1.8em; margin: 0px 0px 10px;"&gt;After the form submission, the file data is submitted to the&amp;nbsp;&lt;code style="background-color: #eeeeee; border-radius: 2px; border: 1px solid rgb(228, 228, 228); box-sizing: border-box; color: #c7254e; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, serif; font-size: 0.875em; line-height: 1.85714em; padding: 2px 4px; white-space: pre-wrap;"&gt;upload.php&lt;/code&gt;&amp;nbsp;file for further processing.&lt;/p&gt;&lt;h2 style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 20px; line-height: 1.2em; margin: 25px 0px 15px;"&gt;Compress and Upload Image with PHP&lt;/h2&gt;&lt;p style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; line-height: 1.8em; margin: 0px 0px 10px;"&gt;In the&amp;nbsp;&lt;code style="background-color: #eeeeee; border-radius: 2px; border: 1px solid rgb(228, 228, 228); box-sizing: border-box; color: #c7254e; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, serif; font-size: 0.875em; line-height: 1.85714em; padding: 2px 4px; white-space: pre-wrap;"&gt;upload.php&lt;/code&gt;&amp;nbsp;file handles the image compression and upload operations.&lt;/p&gt;&lt;ul class="bullet_disk_list" style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 14px; list-style: none; margin-bottom: 10px; margin-top: 0px;"&gt;&lt;li style="box-sizing: border-box; font-size: 16px; line-height: 1.8em; list-style: disc; margin-top: 5px;"&gt;&lt;b style="box-sizing: border-box;"&gt;compressImage()&lt;/b&gt;&amp;nbsp;is a custom function that helps to compress and save image on the server using PHP.&lt;/li&gt;&lt;li style="box-sizing: border-box; font-size: 16px; line-height: 1.8em; list-style: disc; margin-top: 5px;"&gt;If the file is submitted,&lt;ul style="box-sizing: border-box; list-style: none; margin-bottom: 0px; margin-top: 0px;"&gt;&lt;li style="box-sizing: border-box; line-height: 1.8em; list-style: disc; margin-top: 5px;"&gt;Retrieve the file info using the&amp;nbsp;&lt;b style="box-sizing: border-box;"&gt;PHP $_FILES&lt;/b&gt;&amp;nbsp;method.&lt;/li&gt;&lt;li style="box-sizing: border-box; line-height: 1.8em; list-style: disc; margin-top: 5px;"&gt;Compress size and upload image using&amp;nbsp;&lt;code style="background-color: #eeeeee; border-radius: 2px; border: 1px solid rgb(228, 228, 228); box-sizing: border-box; color: #c7254e; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, serif; font-size: 0.875em; line-height: 1.85714em; padding: 2px 4px; white-space: pre-wrap;"&gt;compressImage()&lt;/code&gt;&amp;nbsp;function.&lt;/li&gt;&lt;li style="box-sizing: border-box; line-height: 1.8em; list-style: disc; margin-top: 5px;"&gt;Render the image upload status.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;pre style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 1.42857; margin-bottom: 10px; margin-top: 0px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; white-space: pre-wrap; word-break: break-all;"&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;&amp;lt;?php &lt;br style="box-sizing: border-box;" /&gt; &lt;br style="box-sizing: border-box;" /&gt;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;/* &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;*&amp;nbsp;Custom&amp;nbsp;function&amp;nbsp;to&amp;nbsp;compress&amp;nbsp;image&amp;nbsp;size&amp;nbsp;and &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;*&amp;nbsp;upload&amp;nbsp;to&amp;nbsp;the&amp;nbsp;server&amp;nbsp;using&amp;nbsp;PHP &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;*/ &lt;br style="box-sizing: border-box;" /&gt;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;compressImage&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$source&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$destination&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$quality&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;)&amp;nbsp;{ &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Get&amp;nbsp;image&amp;nbsp;info &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$imgInfo&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;getimagesize&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$source&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;); &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$mime&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$imgInfo&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;[&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'mime'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;]; &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Create&amp;nbsp;a&amp;nbsp;new&amp;nbsp;image&amp;nbsp;from&amp;nbsp;file &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;switch(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$mime&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;){ &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'image/jpeg'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;: &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$image&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;imagecreatefromjpeg&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$source&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;); &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break; &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'image/png'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;: &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$image&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;imagecreatefrompng&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$source&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;); &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break; &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'image/gif'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;: &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$image&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;imagecreatefromgif&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$source&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;); &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break; &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;default: &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$image&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;imagecreatefromjpeg&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$source&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;); &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Save&amp;nbsp;image &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;imagejpeg&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$image&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$destination&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$quality&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;); &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Return&amp;nbsp;compressed&amp;nbsp;image &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;return&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$destination&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;; &lt;br style="box-sizing: border-box;" /&gt;} &lt;br style="box-sizing: border-box;" /&gt; &lt;br style="box-sizing: border-box;" /&gt; &lt;br style="box-sizing: border-box;" /&gt;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;File&amp;nbsp;upload&amp;nbsp;path &lt;br style="box-sizing: border-box;" /&gt;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$uploadPath&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"uploads/"&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;; &lt;br style="box-sizing: border-box;" /&gt; &lt;br style="box-sizing: border-box;" /&gt;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;If&amp;nbsp;file&amp;nbsp;upload&amp;nbsp;form&amp;nbsp;is&amp;nbsp;submitted &lt;br style="box-sizing: border-box;" /&gt;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$status&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$statusMsg&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;''&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;; &lt;br style="box-sizing: border-box;" /&gt;if(isset(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$_POST&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;[&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"submit"&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;])){ &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$status&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'error'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;; &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(!empty(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$_FILES&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;[&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"image"&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;][&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"name"&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;]))&amp;nbsp;{ &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;File&amp;nbsp;info &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$fileName&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;basename&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$_FILES&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;[&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"image"&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;][&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"name"&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;]); &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$imageUploadPath&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$uploadPath&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$fileName&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;; &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$fileType&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;pathinfo&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$imageUploadPath&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;PATHINFO_EXTENSION&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;); &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Allow&amp;nbsp;certain&amp;nbsp;file&amp;nbsp;formats &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$allowTypes&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;array(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'jpg'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'png'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'jpeg'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'gif'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;); &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;in_array&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$fileType&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$allowTypes&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;)){ &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Image&amp;nbsp;temp&amp;nbsp;source &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$imageTemp&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$_FILES&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;[&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"image"&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;][&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"tmp_name"&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;]; &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Compress&amp;nbsp;size&amp;nbsp;and&amp;nbsp;upload&amp;nbsp;image &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$compressedImage&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;compressImage&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$imageTemp&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$imageUploadPath&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;75&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;); &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$compressedImage&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;){ &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$status&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'success'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;; &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$statusMsg&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"Image&amp;nbsp;compressed&amp;nbsp;successfully."&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;; &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}else{ &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$statusMsg&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;"Image&amp;nbsp;compress&amp;nbsp;failed!"&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;; &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}else{ &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$statusMsg&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'Sorry,&amp;nbsp;only&amp;nbsp;JPG,&amp;nbsp;JPEG,&amp;nbsp;PNG,&amp;nbsp;&amp;amp;&amp;nbsp;GIF&amp;nbsp;files&amp;nbsp;are&amp;nbsp;allowed&amp;nbsp;to&amp;nbsp;upload.'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;; &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}else{ &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$statusMsg&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #dd0000;"&gt;'Please&amp;nbsp;select&amp;nbsp;an&amp;nbsp;image&amp;nbsp;file&amp;nbsp;to&amp;nbsp;upload.'&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;; &lt;br style="box-sizing: border-box;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} &lt;br style="box-sizing: border-box;" /&gt;} &lt;br style="box-sizing: border-box;" /&gt; &lt;br style="box-sizing: border-box;" /&gt;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #ff8000;"&gt;//&amp;nbsp;Display&amp;nbsp;status&amp;nbsp;message &lt;br style="box-sizing: border-box;" /&gt;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;$statusMsg&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #007700;"&gt;; &lt;br style="box-sizing: border-box;" /&gt; &lt;br style="box-sizing: border-box;" /&gt;&lt;/span&gt;&lt;span style="box-sizing: border-box; color: #0000bb;"&gt;?&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;p class="seeAlso" style="background-color: #f6f8f7; border-bottom: 0px; border-image: initial; border-left: 4px solid rgb(231, 76, 60) !important; border-right: 0px; border-top: 0px; box-sizing: border-box; color: #222222; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; font-weight: bold; line-height: 1.8em; margin: 0px 0px 10px; padding: 10px 27px;"&gt;&lt;span style="box-sizing: border-box; margin-right: 0.75em;"&gt;&lt;/span&gt;&lt;a href="https://www.codexworld.com/preview-rotate-image-before-upload-using-jquery-php/" style="background: transparent; border-bottom: none; box-sizing: border-box; color: #336633; display: inline-block; margin-right: 10px; text-decoration-line: none;"&gt;Preview and Rotate Image Before Upload using jQuery and PHP&lt;/a&gt;&lt;/p&gt;&lt;h2 style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 20px; line-height: 1.2em; margin: 25px 0px 15px;"&gt;Conclusion&lt;/h2&gt;&lt;p style="background-color: white; box-sizing: border-box; color: #333333; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; line-height: 1.8em; margin: 0px 0px 10px;"&gt;Generally, the move_uploaded_file() function is used to&amp;nbsp;&lt;a href="https://www.codexworld.com/php-file-upload/" style="background: transparent; border-bottom: 1px solid rgb(255, 115, 97); box-sizing: border-box; color: #428bca; text-decoration-line: none;"&gt;upload file in PHP&lt;/a&gt;. But, if you want to compress the image before upload, our custom PHP function (&lt;code style="background-color: #eeeeee; border-radius: 2px; border: 1px solid rgb(228, 228, 228); box-sizing: border-box; color: #c7254e; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, serif; font-size: 0.875em; line-height: 1.85714em; padding: 2px 4px; white-space: pre-wrap;"&gt;compressImage()&lt;/code&gt;) is very useful. The example code helps you to compress the image file without using any&amp;nbsp;&lt;b style="box-sizing: border-box;"&gt;compression library&lt;/b&gt;. With our compression script, you can compress different types of an image file (JPG, JPEG, PNG, and GIF).&lt;/p&gt;</description><link>http://develovers.blogspot.com/2021/04/compress-image-before-upload-using-php.html</link><thr:total>0</thr:total><author>noreply@blogger.com (...:::HiToKiRi.rEd:::...)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6184319049478717608.post-2640557308213376497</guid><pubDate>Thu, 14 Jan 2021 17:42:00 +0000</pubDate><atom:updated>2021-01-15T09:37:34.921-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">AJAX</category><title>Live username availability check in PHP AJAX</title><description>&lt;p&gt;&amp;nbsp;Here we using 2 file for Live username availability check in PHP AJAX&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;a href="#index"&gt;&lt;p&gt;index.php&lt;/p&gt;&lt;/a&gt;&lt;p&gt;check_availability.php&lt;/p&gt;&lt;p&gt;index.php&lt;/p&gt;
&lt;pre class="css"&gt;&lt;code&gt;
&lt;p&gt;&amp;lt;!DOCTYPE HTML&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;lt;html lang="en-US"&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;lt;head&amp;gt;&lt;/p&gt;&lt;p&gt;&lt;span style="white-space: pre;"&gt;	&lt;/span&gt;&amp;lt;meta charset="UTF-8"&amp;gt;&lt;/p&gt;&lt;p&gt;&lt;span style="white-space: pre;"&gt;	&lt;/span&gt;&amp;lt;title&amp;gt;&amp;lt;/title&amp;gt;&lt;/p&gt;&lt;p&gt;&lt;span style="white-space: pre;"&gt;	&lt;/span&gt;&amp;lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;lt;/head&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;lt;body&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;lt;div class="container"&amp;gt;&lt;/p&gt;&lt;p&gt;&lt;span style="white-space: pre;"&gt;	&lt;/span&gt;&amp;lt;div class="row"&amp;gt;&lt;/p&gt;&lt;p&gt;&lt;span style="white-space: pre;"&gt;		&lt;/span&gt;&amp;lt;div id="frmCheckUsername"&amp;gt;&lt;/p&gt;&lt;p&gt;&lt;span style="white-space: pre;"&gt;			&lt;/span&gt;&amp;lt;label&amp;gt;Check Username:&amp;lt;/label&amp;gt;&lt;/p&gt;&lt;p&gt;&lt;span style="white-space: pre;"&gt;			&lt;/span&gt;&amp;lt;input name="username" type="text" id="username" class="demoInputBox" onBlur="checkAvailability()"&amp;gt;&amp;lt;span id="user-availability-status"&amp;gt;&amp;lt;/span&amp;gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="white-space: pre;"&gt;		&lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/p&gt;&lt;p&gt;&lt;span style="white-space: pre;"&gt;		&lt;/span&gt;&amp;lt;p&amp;gt;&amp;lt;img src="loder.gif" id="loaderIcon" style="display:none" /&amp;gt;&amp;lt;/p&amp;gt;&lt;/p&gt;&lt;p&gt;&lt;span style="white-space: pre;"&gt;	&lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;lt;/div&amp;gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;/p&gt;&lt;p&gt;function checkAvailability(){&lt;/p&gt;&lt;p&gt;&lt;span style="white-space: pre;"&gt;	&lt;/span&gt;$("#loaderIcon").show();&lt;/p&gt;&lt;p&gt;&lt;span style="white-space: pre;"&gt;	&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="white-space: pre;"&gt;	&lt;/span&gt;$.ajax({&lt;/p&gt;&lt;p&gt;&lt;span style="white-space: pre;"&gt;		&lt;/span&gt;type:"POST",&lt;/p&gt;&lt;p&gt;&lt;span style="white-space: pre;"&gt;		&lt;/span&gt;url:"check_availability.php",&lt;/p&gt;&lt;p&gt;&lt;span style="white-space: pre;"&gt;		&lt;/span&gt;cache:false,&lt;/p&gt;&lt;p&gt;&lt;span style="white-space: pre;"&gt;		&lt;/span&gt;data:{&lt;/p&gt;&lt;p&gt;&lt;span style="white-space: pre;"&gt;			&lt;/span&gt;type:1,&lt;/p&gt;&lt;p&gt;&lt;span style="white-space: pre;"&gt;			&lt;/span&gt;username:$("#username").val(),&lt;/p&gt;&lt;p&gt;&lt;span style="white-space: pre;"&gt;		&lt;/span&gt;},&lt;/p&gt;&lt;p&gt;&lt;span style="white-space: pre;"&gt;		&lt;/span&gt;success:function(data){&lt;/p&gt;&lt;p&gt;&lt;span style="white-space: pre;"&gt;			&lt;/span&gt;$("#user-availability-status").html(data);&lt;/p&gt;&lt;p&gt;&lt;span style="white-space: pre;"&gt;			&lt;/span&gt;$("#loaderIcon").hide(1000);&lt;/p&gt;&lt;p&gt;&lt;span style="white-space: pre;"&gt;		&lt;/span&gt;}&lt;/p&gt;&lt;p&gt;&lt;span style="white-space: pre;"&gt;	&lt;/span&gt;});&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;p&gt;&amp;lt;/script&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;lt;/body&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;lt;/html&amp;gt;&lt;/p&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p id="check_availability"&gt;check_availability.php&lt;/p&gt;
&lt;pre class="css"&gt;&lt;code&gt;/* Related Posts Middle by igniel.com */
.ignielRelatedMiddle {background-color:#f5f5f5; border:1px solid #e5e5e5; display:block; margin:20px 0px; padding:10px 20px;}
.ignielRelatedMiddle .judul {color:#f44336; font-size:120%; font-weight:600; text-transform:uppercase}
.ignielRelatedMiddle ul {margin:10px 0px 0px !important; padding:0px !important;}
.ignielRelatedMiddle ul li {list-style:none; padding:5px 0px !important; border-bottom:2px dotted #aaa !important; text-align:left !important; line-height:1.25em !important;}
.ignielRelatedMiddle ul li:first-child {padding-top:0px; !important;}
.ignielRelatedMiddle ul li:last-child {padding-bottom:0px !important; border:0px !important}
.ignielRelatedMiddle ul li a:before{content:''; display:inline-block; width:17px; height:17px; margin-right:3px; vertical-align:-3px; background:url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z' fill='%23333'/%3E%3C/svg%3E") center / 20px no-repeat;}&lt;/code&gt;&lt;/pre&gt;</description><link>http://develovers.blogspot.com/2021/01/live-username-availability-check-in-php-ajax.html</link><thr:total>0</thr:total><author>noreply@blogger.com (...:::HiToKiRi.rEd:::...)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6184319049478717608.post-8332466640036301432</guid><pubDate>Thu, 16 Jul 2020 17:31:00 +0000</pubDate><atom:updated>2020-07-16T10:31:14.632-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Web Developer</category><title>Menampilkan Menu Ketika Scrool ke Bawah</title><description>&lt;br /&gt;
Cara Geser Bar ke Bawah&lt;br /&gt;
Langkah 1) Tambahkan HTML:&lt;br /&gt;
Buat bilah navigasi:&lt;br /&gt;
&lt;br /&gt;
Contoh&lt;br /&gt;
&lt;pre&gt;&amp;lt;div id="navbar"&amp;gt;

&amp;nbsp; &amp;lt;a href="#home"&amp;gt;Home&amp;lt;/a&amp;gt;

&amp;nbsp; &amp;lt;a href="#news"&amp;gt;News&amp;lt;/a&amp;gt;

&amp;nbsp; &amp;lt;a href="#contact"&amp;gt;Contact&amp;lt;/a&amp;gt;

&amp;lt;/div&amp;gt;&lt;/pre&gt;
&lt;br /&gt;
Langkah 2) Tambahkan CSS:&lt;br /&gt;
Gaya bilah navigasi:&lt;br /&gt;
&lt;br /&gt;
Contoh&lt;br /&gt;
&lt;pre&gt;#navbar {

&amp;nbsp; background-color: #333; /* Black background color */

&amp;nbsp; position: fixed; /* Make it stick/fixed */

&amp;nbsp; top: -50px; /* Hide the navbar 50 px outside of the top view */

&amp;nbsp; width: 100%; /* Full width */

&amp;nbsp; transition: top 0.3s; /* Transition effect when sliding down (and up) */

}



/* Style the navbar links */

#navbar a {

&amp;nbsp; float: left;

&amp;nbsp; display: block;

&amp;nbsp; color: white;

&amp;nbsp; text-align: center;

&amp;nbsp; padding: 15px;

&amp;nbsp; text-decoration: none;

}



#navbar a:hover {

&amp;nbsp; background-color: #ddd;

&amp;nbsp; color: black;

}
&lt;/pre&gt;
&lt;br /&gt;
Langkah 3) Tambahkan JavaScript:&lt;br /&gt;
Contoh&lt;br /&gt;
&lt;pre&gt;// When the user scrolls down 20px from the top of the document, slide down the navbar

// When the user scrolls to the top of the page, slide up the navbar (50px out of the top view)

window.onscroll = function() {scrollFunction()};



function scrollFunction() {

&amp;nbsp; if (document.body.scrollTop &amp;gt; 20 || document.documentElement.scrollTop &amp;gt; 20) {

&amp;nbsp; &amp;nbsp; document.getElementById("navbar").style.top = "0";

&amp;nbsp; } else {

&amp;nbsp; &amp;nbsp; document.getElementById("navbar").style.top = "-50px";

&amp;nbsp; }

}
&lt;/pre&gt;
</description><link>http://develovers.blogspot.com/2020/07/menampilkan-menu-ketika-scrool-ke-bawah.html</link><thr:total>0</thr:total><author>noreply@blogger.com (...:::HiToKiRi.rEd:::...)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6184319049478717608.post-1048177937094286812</guid><pubDate>Thu, 16 Jul 2020 15:48:00 +0000</pubDate><atom:updated>2020-07-16T10:31:28.131-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Web Developer</category><title>Membuat Website Responsive dengan 3 Langkah Mudah</title><description>&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJ0gpHxYqnqKHhlNC12URchwr_CRZ30BHFuZGQNMqxcjz3Wix7LYIfMYNSOaG0TZEpbdMZEin4Jl3c3suIY6JD1Seir9ukr5dvETk9OtAVd310TBmdHXzssCd6oovfTqI5HkUcUVReFPg/s1600/blog-01-01.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" data-original-height="539" data-original-width="920" height="370" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJ0gpHxYqnqKHhlNC12URchwr_CRZ30BHFuZGQNMqxcjz3Wix7LYIfMYNSOaG0TZEpbdMZEin4Jl3c3suIY6JD1Seir9ukr5dvETk9OtAVd310TBmdHXzssCd6oovfTqI5HkUcUVReFPg/s640/blog-01-01.jpg" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Saat ini, situs web tidak hanya harus terlihat bagus di layar desktop, tetapi juga di tablet dan ponsel cerdas.&lt;br /&gt;
&lt;br /&gt;
Sebuah situs web responsif jika mampu beradaptasi dengan layar klien.&lt;br /&gt;
&lt;br /&gt;
Desain web responsif sangat penting saat ini dan sebenarnya merupakan salah satu teknik yang perlu Anda kuasai sebagai pengembang web atau desainer web.&lt;br /&gt;
&lt;br /&gt;
Pada artikel ini, saya akan menunjukkan kepada Anda bagaimana membangun situs responsif dengan mudah dan bagaimana menerapkan teknik desain responsif pada halaman web yang ada dalam tiga langkah mudah.&lt;br /&gt;
&lt;br /&gt;
Ketika membangun situs web responsif, atau membuat situs responsif, hal pertama yang harus dilihat adalah tata letaknya.&lt;br /&gt;
&lt;br /&gt;
Ketika saya membangun situs web yang responsif, saya selalu memulai dengan membuat tata letak yang tidak responsif, ditetapkan pada ukuran standar. Misalnya, lebar default CatsWhoCode.com adalah 1100px.&lt;br /&gt;
&lt;br /&gt;
Ketika saya senang dengan tata letak yang tidak responsif, saya menambahkan pertanyaan media dan sedikit perubahan pada CSS saya untuk membuat situs yang responsif. Ketika datang ke desain web, itu jauh lebih mudah untuk fokus pada satu tugas pada suatu waktu.&lt;br /&gt;
&lt;br /&gt;
Situs Di Perangkat Seluler&lt;br /&gt;
Ketika Anda selesai dengan tata letak yang tidak responsif, hal pertama yang harus dilakukan adalah menempelkan baris berikut di dalam tag &amp;lt;head&amp;gt; dan &amp;lt;/head&amp;gt; pada halaman HTML Anda.&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&amp;lt;meta name = "viewport" content = "width = lebar perangkat, skala awal = 1, skala maksimum = 1, skala pengguna = tidak ada"&amp;gt;
&amp;lt;meta http-equiv = "Kompatibel dengan X-UA" content = "IE = edge, chrome = 1"&amp;gt;
&amp;lt;meta name = "HandheldFriendly" content = "true"&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
Ini akan mengatur tampilan pada semua layar pada rasio aspek 1 × 1 dan menghapus fungsi default dari iPhone dan perangkat seluler lainnya yang membuat situs web pada tampilan penuh dan memungkinkan pengguna untuk memperbesar tata letak dengan menjepit.&lt;br /&gt;
&lt;br /&gt;
Sekarang saatnya untuk menambahkan beberapa pertanyaan media. Menurut situs W3C , &lt;code&gt;&lt;i&gt;Queries Media&lt;/i&gt;&lt;/code&gt; terdiri dari jenis media dan nol atau lebih ekspresi yang memeriksa kondisi fitur media tertentu. Dengan menggunakan kueri media, presentasi dapat disesuaikan dengan rentang perangkat output tertentu tanpa mengubah kontennya sendiri.&lt;br /&gt;
&lt;br /&gt;
Dengan kata lain, kueri media memungkinkan situs web Anda terlihat bagus di semua jenis tampilan, dari ponsel cerdas hingga layar besar. Inilah yang disebut desain web responsif .&lt;br /&gt;
&lt;br /&gt;
Kueri media bergantung pada tata letak situs web Anda, jadi cukup sulit bagi saya untuk memberi Anda cuplikan kode yang siap digunakan. Namun, kode di bawah ini adalah titik awal yang baik untuk sebagian besar situs web. Dalam contoh ini, #primaryadalah area konten utama, dan #secondarybilah samping.&lt;br /&gt;
&lt;br /&gt;
Dengan melihat kode, Anda dapat melihat bahwa saya menetapkan dua ukuran: Yang pertama memiliki lebar maksimum 1060px dan dioptimalkan untuk tampilan lanskap tablet. #primarymenempati 67% dari wadah induknya, dan #secondary30%, ditambah margin kiri 3%.&lt;br /&gt;
&lt;br /&gt;
Ukuran kedua dirancang untuk potret tablet dan ukuran yang lebih kecil. Karena ukuran layar smartphone yang kecil, saya memutuskan untuk memberikan #primarylebar 100%. #secondaryjuga memiliki lebar 100%, dan akan ditampilkan di bawah #primary.&lt;br /&gt;
&lt;br /&gt;
Seperti yang sudah saya katakan, Anda mungkin harus menyesuaikan sedikit kode ini agar sesuai dengan kebutuhan spesifik situs web Anda. Tempel di .cssfile situs Anda .&lt;br /&gt;
&lt;br /&gt;
/ * Pertanyaan Media: Lansekap Tablet * /&lt;br /&gt;
Layar @ media dan (max-width: 1060px) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; #primary {width: 67%; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; #secondary {width: 30%; margin-kiri: 3%;}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/ * Pertanyaan Media: Potret Tabled * /&lt;br /&gt;
Layar @ media dan (max-width: 768px) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; #primary {width: 100%; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; #secondary {width: 100%; margin: 0; perbatasan: tidak ada; }&lt;br /&gt;
}&lt;br /&gt;
Setelah selesai, mari kita lihat seberapa responsif tata letak Anda. Untuk melakukannya, saya menggunakan alat luar biasa yang dibuat oleh Matt Kersley. Anda tentu saja dapat memeriksa hasilnya di perangkat seluler Anda sendiri.&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/9TKa6zrfFVo/0.jpg" frameborder="0" height="400px" src="https://www.youtube.com/embed/9TKa6zrfFVo?feature=player_embedded" width="100%"&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
2 - Media&lt;/h3&gt;
Tata letak yang responsif adalah langkah pertama menuju situs web yang sepenuhnya responsif. Sekarang, mari kita fokus pada aspek yang sangat penting dari situs web modern: media, seperti video atau gambar .&lt;br /&gt;
&lt;br /&gt;
Kode CSS di bawah ini akan memastikan bahwa gambar Anda tidak akan pernah lebih besar dari wadah induknya. Ini sangat sederhana dan berfungsi untuk situs web yang paling responsif. Agar berfungsi dengan benar, cuplikan kode ini harus dimasukkan ke dalam stylesheet CSS Anda.&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;img {max-width: 100%; tinggi: otomatis; }&lt;/pre&gt;
&lt;br /&gt;
Meskipun teknik di atas efisien, kadang-kadang Anda mungkin perlu memiliki kontrol lebih besar atas gambar dan menampilkan gambar yang berbeda sesuai dengan ukuran tampilan klien.&lt;br /&gt;
&lt;br /&gt;
Ini adalah teknik yang dikembangkan oleh Nicolas Gallagher . Mari kita mulai dengan html:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Cara Membuat Situs Web Responsif dalam 3 Langkah Mudah 1&lt;br /&gt;
Seperti yang Anda lihat, kami menggunakan data-*atribut untuk menyimpan url gambar pengganti. Sekarang, mari gunakan kekuatan penuh CSS3 untuk mengganti gambar default dengan salah satu gambar pengganti yang ditentukan jika min-device-widthkondisinya cocok:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;@ media (lebar perangkat minimum: 600px) {

&amp;nbsp; &amp;nbsp; img [data-src-600px] {

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; konten: attr (data-src-600px, url);

&amp;nbsp; &amp;nbsp; }

}



@ media (lebar perangkat minimum: 800px) {

&amp;nbsp; &amp;nbsp; img [data-src-800px] {

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; konten: attr (data-src-800px, url);

&amp;nbsp; &amp;nbsp; }

}

&lt;/pre&gt;
Mengesankan, bukan? Sekarang mari kita lihat media lain yang sangat penting di situs web hari ini: video.&lt;br /&gt;
&lt;br /&gt;
Karena sebagian besar situs web menggunakan video dari situs pihak ketiga seperti YouTube atau Vimeo, saya memutuskan untuk fokus pada teknik video elastis oleh Nick La . Teknik ini memungkinkan Anda untuk membuat video yang tertanam responsif.&lt;br /&gt;
&lt;br /&gt;
HTML:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dan sekarang, CSS:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;.video-container {

&lt;span style="white-space: pre;"&gt; &lt;/span&gt;posisi: relatif;

&lt;span style="white-space: pre;"&gt; &lt;/span&gt;padding-bottom: 56,25%;

&lt;span style="white-space: pre;"&gt; &lt;/span&gt;padding-top: 30px;

&lt;span style="white-space: pre;"&gt; &lt;/span&gt;tinggi: 0;

&lt;span style="white-space: pre;"&gt; &lt;/span&gt;overflow: disembunyikan;

}



.video-wadah iframe,

.video-objek kontainer,

.video-container embed {

&lt;span style="white-space: pre;"&gt; &lt;/span&gt;posisi: absolut;

&lt;span style="white-space: pre;"&gt; &lt;/span&gt;atas: 0;

&lt;span style="white-space: pre;"&gt; &lt;/span&gt;kiri: 0;

&lt;span style="white-space: pre;"&gt; &lt;/span&gt;lebar: 100%;

&lt;span style="white-space: pre;"&gt; &lt;/span&gt;tinggi: 100%;

}

&lt;/pre&gt;
Setelah Anda menerapkan kode ini ke situs web Anda, video yang disematkan sekarang responsif.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
3 - Tipografi&lt;/h3&gt;
Langkah terakhir dari tutorial ini jelas penting, tetapi seringkali diabaikan oleh pengembang ketika datang ke situs web responsif: Tipografi.&lt;br /&gt;
&lt;br /&gt;
Sampai saat ini, sebagian besar pengembang menggunakan piksel untuk menentukan ukuran font. Meskipun piksel baik-baik saja ketika situs web Anda memiliki lebar tetap, situs web responsif harus memiliki font yang responsif. Ukuran font situs Anda harus terkait dengan lebar wadah induknya, sehingga dapat beradaptasi dengan layar klien dan mudah dibaca pada perangkat seluler.&lt;br /&gt;
&lt;br /&gt;
Spesifikasi CSS3 termasuk unit baru bernama rems. Mereka bekerja hampir identik dengan emunit, tetapi relatif terhadap htmlelemen, yang membuatnya jauh lebih mudah digunakan daripada ems.&lt;br /&gt;
&lt;br /&gt;
Karena remssifatnya relatif terhadap htmlelemen, jangan lupa mengatur ulang htmlukuran font:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;html {ukuran font: 100%; }&lt;/pre&gt;
&lt;br /&gt;
Setelah selesai, Anda dapat menentukan ukuran font responsif seperti yang ditunjukkan di bawah ini:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;@ media (lebar minimum: 640px) {body {ukuran font: 1rem;}}

@ media (lebar minimum: 960px) {body {ukuran font: 1.2rem;}}

@ media (lebar minimum: 1100px) {body {ukuran font: 1.5rem;}}

&lt;/pre&gt;
Untuk informasi lebih lanjut tentang remunit ini, saya sarankan Anda artikel yang bermanfaat ini . Pastikan juga untuk memeriksa panduan teknik desain web responsif ini .</description><link>http://develovers.blogspot.com/2020/07/membuat-website-responsive-dengan-3-langkah-mudah.html</link><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJ0gpHxYqnqKHhlNC12URchwr_CRZ30BHFuZGQNMqxcjz3Wix7LYIfMYNSOaG0TZEpbdMZEin4Jl3c3suIY6JD1Seir9ukr5dvETk9OtAVd310TBmdHXzssCd6oovfTqI5HkUcUVReFPg/s72-c/blog-01-01.jpg" width="72"/><thr:total>0</thr:total><author>noreply@blogger.com (...:::HiToKiRi.rEd:::...)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6184319049478717608.post-3378211150442843837</guid><pubDate>Thu, 23 Oct 2014 17:53:00 +0000</pubDate><atom:updated>2014-10-23T12:11:20.759-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Android</category><category domain="http://www.blogger.com/atom/ns#">Pemula</category><category domain="http://www.blogger.com/atom/ns#">Tips &amp; Trik</category><title>Cara Mudah Mengganti Style ActionBar Android</title><description>&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWJGbxjGxfC6XlqNgbT7wIifmCFPsLfSJLbV78B-7MNdamG9SKqOdZlsmxLg5fYyaTRDqf8vXwxsDcJDZTXpfBrq_abtRqe1tfRRoiXXss05tGF520G1oNXZZQJ4jds3FWogJjTwARKtY/s1600/change_action_bar_1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWJGbxjGxfC6XlqNgbT7wIifmCFPsLfSJLbV78B-7MNdamG9SKqOdZlsmxLg5fYyaTRDqf8vXwxsDcJDZTXpfBrq_abtRqe1tfRRoiXXss05tGF520G1oNXZZQJ4jds3FWogJjTwARKtY/s1600/change_action_bar_1.jpg" height="220" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;h3&gt;
Deskripsi:&lt;/h3&gt;
Secara bawaan, ActionBar sudah ada pada Android dengan tiga type, yakni Holo, Dark dan &lt;br /&gt;
Transparan. Untuk membuat aplikasi yang kita rancang tampil beda dari biasanya dalam hal ini saya contohkan aplikasi ActionBar dengan tampilan seperti Facebook, maka tambahkan kode berikut ini pada file &lt;code&gt;***.java&lt;/code&gt; yang terletak pada folder &lt;code&gt;src/nama_package&lt;/code&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
&lt;span style="color: #0b5394;"&gt;Langkah 1&lt;/span&gt;: Masukkan kode berikut ke dalam file ***.java&lt;/h3&gt;
&lt;pre&gt;public class Develovers extends Activity {

&amp;nbsp; &amp;nbsp; @Override

&amp;nbsp; &amp;nbsp; public void onCreate(Bundle savedInstanceState) {

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; super.onCreate(savedInstanceState);

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; setContentView(R.layout.dashboard_layout);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;

&amp;nbsp; &amp;nbsp; &amp;nbsp;// mengganti ActionBar (ganti background dan sembunyikan icon)

&lt;span class="Apple-tab-span"&gt;  &lt;/span&gt;getActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#3b5998")));
&lt;/pre&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/pre&gt;
&lt;h3&gt;
&lt;span style="color: #0b5394;"&gt;Langkah 2&lt;/span&gt;: Perbaiki kode yang salah&lt;/h3&gt;
Apabila Anda meng-copy paste kode di Atas, maka akan ada kode yang bermasalah, cara memperbaikinya arahkan kursor ke baris kode yang bermasalah dan ketik Ctrl+1&lt;br /&gt;
&lt;br /&gt;
Jangan lupa berikan komentar Anda apabila mengalami kesulitan pada tutorial ini. :)</description><link>http://develovers.blogspot.com/2014/10/cara-mudah-mengganti-style-actionbar.html</link><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWJGbxjGxfC6XlqNgbT7wIifmCFPsLfSJLbV78B-7MNdamG9SKqOdZlsmxLg5fYyaTRDqf8vXwxsDcJDZTXpfBrq_abtRqe1tfRRoiXXss05tGF520G1oNXZZQJ4jds3FWogJjTwARKtY/s72-c/change_action_bar_1.jpg" width="72"/><thr:total>0</thr:total><author>noreply@blogger.com (...:::HiToKiRi.rEd:::...)</author></item></channel></rss>