<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2275808999334860244</id><updated>2026-03-12T11:20:43.924+05:30</updated><category term="ASP.NET"/><category term="C#.NET"/><category term="PHP"/><category term="HTML"/><category term="Jquery"/><category term="MS SQL"/><category term="T-SQL"/><category term="Codeigniter Shield"/><category term="IIS"/><category term="AJAX"/><category term="CSS"/><category term="Hosting"/><category term="InnoDB"/><category term="Json"/><category term="MS Excel"/><category term="MySQL"/><category term="VSCode"/><category term="Authorization"/><category term="Codeigniter"/><category term="Desktop Application"/><category term="Electron Forge"/><category term="Email verification"/><category term="Gmail SMTP Server"/><category term="Group Replication"/><category term="JavaScript"/><category term="Laravel"/><category term="React"/><category term="Two-factor Authentication"/><category term="WordPress"/><title type='text'>Code Snippets</title><subtitle type='html'>Developers Resource</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://gcsujai.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://gcsujai.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Sujai GC</name><uri>http://www.blogger.com/profile/17693804644569493968</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>41</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2275808999334860244.post-4639902878594162869</id><published>2025-01-08T14:50:00.004+05:30</published><updated>2025-12-22T11:18:57.107+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Authorization"/><category scheme="http://www.blogger.com/atom/ns#" term="Codeigniter Shield"/><title type='text'>Codeigniter Shield Authorization</title><content type='html'>&lt;h2 style=&quot;text-align: left;&quot;&gt;&lt;b&gt;Codeigniter Shield Authorization&lt;/b&gt;&lt;/h2&gt;&lt;p&gt;CodeIgniter Shield is the official authentication and authorization framework for CodeIgniter 4. It provides a flexible role-based access control (RBAC) system, allowing you to manage user permissions effectively.&lt;/p&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Key Concepts:&lt;/h3&gt;&lt;p&gt;&lt;b&gt;Groups:&lt;/b&gt; Users can belong to multiple groups, which can represent traditional roles (e.g., admin, moderator) or be used to group users based on features or other criteria.&lt;/p&gt;&lt;p&gt;&lt;b&gt;Permissions:&lt;/b&gt; Permissions define what actions a user is allowed to perform within your application. Permissions are typically associated with groups.&lt;/p&gt;&lt;p&gt;&lt;b&gt;Users:&lt;/b&gt; Each user has a set of permissions based on the groups they belong to, and can also have permissions directly assigned to them.&lt;/p&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Defining Groups:&lt;/h3&gt;&lt;p&gt;Groups are defined in the Shield\Config\AuthGroups configuration file. Each group has a key, a title, and an optional description.&lt;/p&gt;&lt;div style=&quot;background-color: #1e1f22; color: #bcbec4;&quot;&gt;&lt;pre style=&quot;font-family: &amp;quot;JetBrains Mono&amp;quot;, monospace; font-size: 9.8pt;&quot;&gt;php&lt;br /&gt;public &lt;span style=&quot;color: #cf8e6d;&quot;&gt;array &lt;/span&gt;$groups = [&lt;br /&gt;    &lt;span style=&quot;color: #6aab73;&quot;&gt;&#39;superadmin&#39; &lt;/span&gt;=&amp;gt; [&lt;br /&gt;        &lt;span style=&quot;color: #6aab73;&quot;&gt;&#39;title&#39;       &lt;/span&gt;=&amp;gt; &lt;span style=&quot;color: #6aab73;&quot;&gt;&#39;Super Admin&#39;&lt;/span&gt;,&lt;br /&gt;        &lt;span style=&quot;color: #6aab73;&quot;&gt;&#39;description&#39; &lt;/span&gt;=&amp;gt; &lt;span style=&quot;color: #6aab73;&quot;&gt;&#39;Optional description of the group.&#39;&lt;/span&gt;,&lt;br /&gt;    ],&lt;br /&gt;    &lt;span style=&quot;color: #6aab73;&quot;&gt;&#39;editor&#39; &lt;/span&gt;=&amp;gt; [&lt;br /&gt;        &lt;span style=&quot;color: #6aab73;&quot;&gt;&#39;title&#39; &lt;/span&gt;=&amp;gt; &lt;span style=&quot;color: #6aab73;&quot;&gt;&#39;Editor&#39;&lt;/span&gt;,&lt;br /&gt;        &lt;span style=&quot;color: #6aab73;&quot;&gt;&#39;description&#39; &lt;/span&gt;=&amp;gt; &lt;span style=&quot;color: #6aab73;&quot;&gt;&#39;Can edit content.&#39;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #6aab73;&quot;&gt;    &lt;/span&gt;],&lt;br /&gt;    &lt;span style=&quot;color: #6aab73;&quot;&gt;&#39;user&#39; &lt;/span&gt;=&amp;gt; [&lt;br /&gt;        &lt;span style=&quot;color: #6aab73;&quot;&gt;&#39;title&#39; &lt;/span&gt;=&amp;gt; &lt;span style=&quot;color: #6aab73;&quot;&gt;&#39;User&#39;&lt;/span&gt;,&lt;br /&gt;        &lt;span style=&quot;color: #6aab73;&quot;&gt;&#39;description&#39; &lt;/span&gt;=&amp;gt; &lt;span style=&quot;color: #6aab73;&quot;&gt;&#39;Basic user access.&#39;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #6aab73;&quot;&gt;    &lt;/span&gt;]&lt;br /&gt;];&lt;/pre&gt;&lt;/div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Defining Permissions:&lt;/h3&gt;&lt;div&gt;&lt;div style=&quot;background-color: #1e1f22; color: #bcbec4;&quot;&gt;&lt;pre style=&quot;font-family: &amp;quot;JetBrains Mono&amp;quot;, monospace; font-size: 9.8pt;&quot;&gt;php&lt;br /&gt;public array $permissions = [
    &#39;superadmin.access&#39;   =&amp;gt; &#39;Can access the sites admin area&#39;,
    &#39;superadmin.settings&#39; =&amp;gt; &#39;Can access the main site settings&#39;,
    &#39;editor.create&#39;       =&amp;gt; &#39;Can view/edit site content&#39;,
    &#39;users.create&#39;        =&amp;gt; &#39;Can create new non-admin users&#39;,
    &#39;users.edit&#39;          =&amp;gt; &#39;Can edit existing non-admin users&#39;,
    &#39;users.delete&#39;        =&amp;gt; &#39;Can delete existing non-admin users&#39;,
];&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Checking Permissions:&lt;/h3&gt;&lt;p&gt;You can check if a user has a specific permission using the can() method on the User entity. This method checks permissions within the groups the user belongs to, as well as any permissions directly assigned to the user.&lt;/p&gt;&lt;div style=&quot;background-color: #1e1f22; color: #bcbec4;&quot;&gt;&lt;pre style=&quot;font-family: &amp;quot;JetBrains Mono&amp;quot;, monospace; font-size: 9.8pt;&quot;&gt;php&lt;br /&gt;if (! auth()-&amp;gt;user()-&amp;gt;can(&lt;span style=&quot;color: #6aab73;&quot;&gt;&#39;users.create&#39;&lt;/span&gt;)) {&lt;br /&gt;    &lt;span style=&quot;color: #cf8e6d;&quot;&gt;return &lt;/span&gt;redirect()-&amp;gt;back()-&amp;gt;with(&lt;span style=&quot;color: #6aab73;&quot;&gt;&#39;error&#39;&lt;/span&gt;, &lt;span style=&quot;color: #6aab73;&quot;&gt;&#39;You do not have permissions to access that page.&#39;&lt;/span&gt;);&lt;br /&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Example:&lt;/h3&gt;&lt;p&gt;Let&#39;s say you have a &#39;superadmin&#39; group with the permission users.create. You can check if the current user has this permission like this:&lt;/p&gt;&lt;div style=&quot;background-color: #1e1f22; color: #bcbec4;&quot;&gt;&lt;pre style=&quot;font-family: &amp;quot;JetBrains Mono&amp;quot;, monospace; font-size: 9.8pt;&quot;&gt;php&lt;br /&gt;if (auth()-&amp;gt;user()-&amp;gt;can(&lt;span style=&quot;color: #6aab73;&quot;&gt;&#39;users.create&#39;&lt;/span&gt;)) {&lt;br /&gt;    &lt;span style=&quot;color: #7a7e85;&quot;&gt;// Allow user to create a new user&lt;br /&gt;&lt;/span&gt;} else {&lt;br /&gt;   &lt;span style=&quot;color: #7a7e85;&quot;&gt;// Redirect or show an error message&lt;br /&gt;&lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Getting the Current User:&lt;/h3&gt;&lt;p&gt;You can get the current user using the auth() helper function:&lt;/p&gt;&lt;div style=&quot;background-color: #1e1f22; color: #bcbec4;&quot;&gt;&lt;pre style=&quot;font-family: &amp;quot;JetBrains Mono&amp;quot;, monospace; font-size: 9.8pt;&quot;&gt;php&lt;br /&gt;$user = auth()-&amp;gt;user();&lt;/pre&gt;&lt;/div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Adding Group To a User:&lt;/h3&gt;&lt;div&gt;&lt;div style=&quot;background-color: #1e1f22;&quot;&gt;&lt;pre&gt;&lt;span style=&quot;color: #bcbec4; font-family: JetBrains Mono, monospace;&quot;&gt;&lt;span style=&quot;font-size: 13.0667px;&quot;&gt;php&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;color: #bcbec4; font-family: JetBrains Mono, monospace;&quot;&gt;&lt;span style=&quot;font-size: 13.0667px;&quot;&gt;$user = auth()-&amp;gt;user();
$user-&amp;gt;addGroup(&#39;superadmin&#39;, &#39;editor&#39;);&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Removing Group From a User:&lt;/h3&gt;&lt;div&gt;&lt;div style=&quot;background-color: #1e1f22;&quot;&gt;&lt;pre&gt;&lt;span style=&quot;color: #bcbec4; font-family: JetBrains Mono, monospace;&quot;&gt;&lt;span style=&quot;font-size: 9.8pt;&quot;&gt;php&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 13.0667px;&quot;&gt;$user = auth()-&amp;gt;user();
$user-&amp;gt;removeGroup(&#39;superadmin&#39;, &#39;editor&#39;);&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Check if User Belongs to a Group:&lt;/h3&gt;&lt;div&gt;&lt;div style=&quot;background-color: #1e1f22; color: #bcbec4;&quot;&gt;&lt;pre style=&quot;font-family: &amp;quot;JetBrains Mono&amp;quot;, monospace; font-size: 9.8pt;&quot;&gt;php&lt;br /&gt;$user = auth()-&amp;gt;user();
if ($user-&amp;gt;inGroup(&#39;superadmin&#39;)) {
    // do something
}&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;In summary, CodeIgniter Shield&#39;s authorization system allows you to:&lt;/p&gt;&lt;p&gt;Define user groups with specific roles and permissions.&lt;/p&gt;&lt;p&gt;Assign users to one or more groups.&lt;/p&gt;&lt;p&gt;Check if a user has the necessary permissions to perform an action.&lt;/p&gt;&lt;p&gt;This provides a flexible and robust way to manage access control in your CodeIgniter application.&lt;/p&gt;&lt;p&gt;&lt;u style=&quot;background-color: #6fa8dc;&quot;&gt;Advertisement&lt;/u&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://amzn.to/48Pawnv&quot; target=&quot;_blank&quot;&gt;JBL Wave Buds 2 Ear Buds Wireless BluetoothV5.3, Active Noise Cancellation EarBuds,Multi Connect, App for Customized Extra Bass Eq, Relax Mode,Speed Charge, 40H Playback, Fast Pair, 4 Mics,IP54(Black)&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://amzn.to/4s6slG2&quot; target=&quot;_blank&quot;&gt;Sony WF-C710N | Dual Noise Cancellation Wireless Bluetooth in Ear Earbuds | AI Call Quality | 40Hrs Battery W/O ANC | 30Hrs Battery with ANC - Blue&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://gcsujai.blogspot.com/feeds/4639902878594162869/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2275808999334860244/4639902878594162869' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/4639902878594162869'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/4639902878594162869'/><link rel='alternate' type='text/html' href='http://gcsujai.blogspot.com/2025/01/codeigniter-shield-authorization.html' title='Codeigniter Shield Authorization'/><author><name>Sujai GC</name><uri>http://www.blogger.com/profile/17693804644569493968</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2275808999334860244.post-3100387470723940244</id><published>2024-04-27T10:30:00.004+05:30</published><updated>2025-12-22T11:13:44.824+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Codeigniter Shield"/><category scheme="http://www.blogger.com/atom/ns#" term="Email verification"/><category scheme="http://www.blogger.com/atom/ns#" term="Gmail SMTP Server"/><category scheme="http://www.blogger.com/atom/ns#" term="Two-factor Authentication"/><title type='text'>Codeigniter Shield - Account Activation &amp; Two-Factor Authentication</title><content type='html'>&lt;h2 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;Account Activation &amp;amp; Two-Factor Authentication&lt;/span&gt;&lt;/h2&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;iframe frameborder=&quot;0&quot; height=&quot;270&quot; src=&quot;https://youtube.com/embed/0dbrqMrNtLQ?si=gQMPdUowmAAZUfYx&quot; style=&quot;background-image: url(https://i.ytimg.com/vi/0dbrqMrNtLQ/hqdefault.jpg);&quot; width=&quot;480&quot;&gt;&lt;/iframe&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Ads&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href=&quot;https://amzn.to/494nm05&quot; target=&quot;_blank&quot;&gt;PHILIPS Audio TAS1400BL Wireless Bluetooth Speaker with Deep Bass, Passive Radiator, 12W Sound Output, 1200mAh Rechargable Battery, RGB Light Modes, 10H Playtime, Supports TF/USB/BT Modes (Blue)&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href=&quot;https://amzn.to/4qGbcSn&quot; target=&quot;_blank&quot;&gt;E GATE Phantom 630DW Dolby Audio 540W Soundbar, Home Theatre 5.1 Channel Sound bar for TV with Wireless Subwoofer (16.5cm) &amp;amp; 2 Satellite Speakers, 3 EQ Mode, Bluetooth 5.3, HDMI-ARC, Optical | eGate&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href=&quot;https://amzn.to/4qpNg5u&quot; target=&quot;_blank&quot;&gt;OnePlus Nord Buds 3 Truly Wireless Bluetooth Earbuds with up to 32dB Active Noise Cancellation, 10mins for 11Hours Fast Charging with Up to 43h Music Playback -Harmonic Gray&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gcsujai.blogspot.com/feeds/3100387470723940244/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2275808999334860244/3100387470723940244' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/3100387470723940244'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/3100387470723940244'/><link rel='alternate' type='text/html' href='http://gcsujai.blogspot.com/2024/04/codeigniter-shield-account-activation.html' title='Codeigniter Shield - Account Activation &amp; Two-Factor Authentication'/><author><name>Sujai GC</name><uri>http://www.blogger.com/profile/17693804644569493968</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/0dbrqMrNtLQ/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2275808999334860244.post-8577366148274417216</id><published>2024-03-21T11:45:00.004+05:30</published><updated>2024-04-03T09:59:15.355+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="CSS"/><category scheme="http://www.blogger.com/atom/ns#" term="Desktop Application"/><category scheme="http://www.blogger.com/atom/ns#" term="Electron Forge"/><category scheme="http://www.blogger.com/atom/ns#" term="HTML"/><category scheme="http://www.blogger.com/atom/ns#" term="JavaScript"/><category scheme="http://www.blogger.com/atom/ns#" term="React"/><title type='text'>Electron app with React and Electron Forge</title><content type='html'>&lt;h2 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;Build Desktop applications with React and Electron Forge&lt;/span&gt;&lt;/h2&gt;&lt;div&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;Create cross-platform desktop applications using modern web development tools and integration of third-party libraries and frameworks with Electron. Build your electron apps with the commonly used web technologies like HTML, JavaScript, CSS. Supports native interface for all platforms like windows, macOS, Linux. Integrate JavaScript frameworks such as React, Vue for front-end tooling. Publish electron apps with built-in templates. Currently Electron apps have support for these templates for publishing,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;Vite&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;Webpack&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;iframe frameborder=&quot;0&quot; height=&quot;270&quot; src=&quot;https://youtube.com/embed/rt2AdoGsjCI?si=GJFAptP9il3tB4It&quot; width=&quot;480&quot;&gt;&lt;/iframe&gt;</content><link rel='replies' type='application/atom+xml' href='http://gcsujai.blogspot.com/feeds/8577366148274417216/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2275808999334860244/8577366148274417216' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/8577366148274417216'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/8577366148274417216'/><link rel='alternate' type='text/html' href='http://gcsujai.blogspot.com/2024/03/electron-app-with-react-and-electron.html' title='Electron app with React and Electron Forge'/><author><name>Sujai GC</name><uri>http://www.blogger.com/profile/17693804644569493968</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/rt2AdoGsjCI/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2275808999334860244.post-3989599761902916283</id><published>2024-03-11T10:43:00.007+05:30</published><updated>2025-12-16T14:29:54.039+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Codeigniter Shield"/><category scheme="http://www.blogger.com/atom/ns#" term="VSCode"/><title type='text'>Codeigniter Shield  - Install and Configure</title><content type='html'>&lt;h2 style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;Install Codeigniter Shield&lt;/span&gt;&lt;/b&gt;&lt;/h2&gt;&lt;div&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;a data-preview=&quot;&quot; href=&quot;https://www.google.com/search?ved=1t:260882&amp;amp;q=Codeigniter+Shield&amp;amp;bbid=2275808999334860244&amp;amp;bpid=3989599761902916283&quot; target=&quot;_blank&quot;&gt;Codeigniter Shield&lt;/a&gt; is the official authentication and authorization framework for &lt;a data-preview=&quot;&quot; href=&quot;https://www.google.com/search?ved=1t:260882&amp;amp;q=codeigniter+4&amp;amp;bbid=2275808999334860244&amp;amp;bpid=3989599761902916283&quot; target=&quot;_blank&quot;&gt;codeigniter 4&lt;/a&gt;. It provides &lt;a data-preview=&quot;&quot; href=&quot;https://www.google.com/search?ved=1t:260882&amp;amp;q=session+authentication+Codeigniter+Shield&amp;amp;bbid=2275808999334860244&amp;amp;bpid=3989599761902916283&quot; target=&quot;_blank&quot;&gt;session authentication&lt;/a&gt;, in which the user ID and password is stored in the session for the subsequent requests to authenticate against. Basically, it has all the features that the modern website offers.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;iframe frameborder=&quot;0&quot; height=&quot;270&quot; src=&quot;https://youtube.com/embed/HteTgBwgy0c?si=tVnHrYt060FV1Sue&quot; style=&quot;background-image: url(https://i.ytimg.com/vi/HteTgBwgy0c/hqdefault.jpg);&quot; width=&quot;480&quot;&gt;&lt;/iframe&gt;</content><link rel='replies' type='application/atom+xml' href='http://gcsujai.blogspot.com/feeds/3989599761902916283/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2275808999334860244/3989599761902916283' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/3989599761902916283'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/3989599761902916283'/><link rel='alternate' type='text/html' href='http://gcsujai.blogspot.com/2024/03/codeigniter-shield-install-and-configure.html' title='Codeigniter Shield  - Install and Configure'/><author><name>Sujai GC</name><uri>http://www.blogger.com/profile/17693804644569493968</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/HteTgBwgy0c/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2275808999334860244.post-3046321895720335452</id><published>2024-03-05T22:12:00.008+05:30</published><updated>2024-04-01T11:36:52.382+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Codeigniter"/><category scheme="http://www.blogger.com/atom/ns#" term="IIS"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><category scheme="http://www.blogger.com/atom/ns#" term="VSCode"/><title type='text'>Codeigniter in Visual Studio Code - Getting started</title><content type='html'>&lt;h2 style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;Getting started with Codeigniter in VSCode&lt;/span&gt;&lt;/b&gt;&lt;/h2&gt;&lt;div&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;Codeigniter is a PHP Framework for building robust and flexible websites. Basically, codigniter can be downloaded from official sources as a zip package and install in your system to start development. But, there are other ways to download and install codeigniter to build web applications. Here, we will demonstrate two ways to get started with codeigniter app development in visual studio code. The two approaches used here are,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Clone Git repository&lt;/li&gt;&lt;li&gt;Composer (tool to install packages and dependencies)&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;iframe frameborder=&quot;0&quot; height=&quot;270&quot; src=&quot;https://youtube.com/embed/gn04h0ZXJRo?si=DslmXLnkaPTXJSsi&quot; style=&quot;background-image: url(https://i.ytimg.com/vi/gn04h0ZXJRo/hqdefault.jpg);&quot; width=&quot;480&quot;&gt;&lt;/iframe&gt;</content><link rel='replies' type='application/atom+xml' href='http://gcsujai.blogspot.com/feeds/3046321895720335452/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2275808999334860244/3046321895720335452' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/3046321895720335452'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/3046321895720335452'/><link rel='alternate' type='text/html' href='http://gcsujai.blogspot.com/2024/03/codeigniter-in-visual-studio-code.html' title='Codeigniter in Visual Studio Code - Getting started'/><author><name>Sujai GC</name><uri>http://www.blogger.com/profile/17693804644569493968</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/gn04h0ZXJRo/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2275808999334860244.post-2979023933628473737</id><published>2024-03-04T21:36:00.004+05:30</published><updated>2025-12-22T11:03:24.263+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="IIS"/><category scheme="http://www.blogger.com/atom/ns#" term="Laravel"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><title type='text'>Setup Laravel in Visual Studio Code - Getting started</title><content type='html'>&lt;h2 style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;Setup Laravel in Visual Studio Code&lt;/span&gt;&lt;/b&gt;&lt;/h2&gt;&lt;div&gt;&lt;a data-preview=&quot;&quot; href=&quot;https://www.google.com/search?ved=1t:260882&amp;amp;q=Laravel&amp;amp;bbid=2275808999334860244&amp;amp;bpid=2979023933628473737&quot; target=&quot;_blank&quot;&gt;Laravel&lt;/a&gt; is a very popular PHP Framework for developing web applications. There are many ways to get started with Laravel development in different platforms. But, the most commonly used IDE by developers is &lt;a data-preview=&quot;&quot; href=&quot;https://www.google.com/search?ved=1t:260882&amp;amp;q=visual+studio+code&amp;amp;bbid=2275808999334860244&amp;amp;bpid=2979023933628473737&quot; target=&quot;_blank&quot;&gt;visual studio code&lt;/a&gt; because it is open source and has support for multiple languages. It even has extensions enabling to integrate third-party tools and services, thus allows for faster development. Here, two approaches are used to download and install Laravel in vscode.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Clone &lt;a data-preview=&quot;&quot; href=&quot;https://www.google.com/search?ved=1t:260882&amp;amp;q=Git+repository&amp;amp;bbid=2275808999334860244&amp;amp;bpid=2979023933628473737&quot; target=&quot;_blank&quot;&gt;Git repository&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a data-preview=&quot;&quot; href=&quot;https://www.google.com/search?ved=1t:260882&amp;amp;q=Composer+PHP&amp;amp;bbid=2275808999334860244&amp;amp;bpid=2979023933628473737&quot; target=&quot;_blank&quot;&gt;Composer&lt;/a&gt; (tool to get packages and dependencies)&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;iframe frameborder=&quot;0&quot; height=&quot;270&quot; src=&quot;https://youtube.com/embed/bBNSrmuBiHA?si=sDsBSJ85f4PL2Q1d&quot; style=&quot;background-image: url(https://i.ytimg.com/vi/bBNSrmuBiHA/hqdefault.jpg);&quot; width=&quot;480&quot;&gt;&lt;/iframe&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;After you download Laravel, first thing that you have to is create a .env file and copy the configurations from the .env.example to .env file. Then, Generate &lt;a data-preview=&quot;&quot; href=&quot;https://www.google.com/search?ved=1t:260882&amp;amp;q=app+key+Laravel&amp;amp;bbid=2275808999334860244&amp;amp;bpid=2979023933628473737&quot; target=&quot;_blank&quot;&gt;app key&lt;/a&gt; and assign to the setting variable.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Advertisement&lt;/div&gt;&lt;div&gt;&lt;p style=&quot;background-color: white; box-sizing: border-box; line-height: 32px; margin-bottom: 0px !important; margin-left: 0px; margin-right: 0px; margin-top: 0px; margin: 0px; padding-block-end: 0px; padding: 0px; text-align: left; text-rendering: optimizelegibility;&quot;&gt;&lt;span style=&quot;background-color: transparent;&quot;&gt;&lt;span style=&quot;color: #0f1111; font-family: courier;&quot;&gt;&lt;a href=&quot;https://amzn.to/3KLRLYZ&quot; target=&quot;_blank&quot;&gt;BigPassport Gas Spring Monitor Arm Stand | Heavy Duty VESA Mount for 13–32 Inch Screens | Adjustable Aluminium Desk Mount for PC, Laptop Monitor – Holds 2–9kg&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gcsujai.blogspot.com/feeds/2979023933628473737/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2275808999334860244/2979023933628473737' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/2979023933628473737'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/2979023933628473737'/><link rel='alternate' type='text/html' href='http://gcsujai.blogspot.com/2024/03/setup-laravel-in-visual-studio-code.html' title='Setup Laravel in Visual Studio Code - Getting started'/><author><name>Sujai GC</name><uri>http://www.blogger.com/profile/17693804644569493968</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/bBNSrmuBiHA/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2275808999334860244.post-1404290864685351930</id><published>2024-02-29T21:58:00.005+05:30</published><updated>2024-04-01T12:25:50.533+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Hosting"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><category scheme="http://www.blogger.com/atom/ns#" term="WordPress"/><title type='text'>Install WordPress on IIS (Internet Information Services)</title><content type='html'>&lt;h2 style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;Install WordPress on IIS&lt;/span&gt;&lt;/b&gt;&lt;/h2&gt;&lt;div&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;WordPress is an open-source Content Management System (CMS) built using core PHP. It is a production ready web application package which can be setup in minutes to publish content for the end users. Administrators have complete control over the information being displayed on the site. Managing all aspects of the site is made possible through admin panel.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;iframe frameborder=&quot;0&quot; height=&quot;270&quot; src=&quot;https://youtube.com/embed/PY_VyqYNcKo?si=JIzxgW4Q7h87u5hu&quot; style=&quot;background-image: url(https://i.ytimg.com/vi/PY_VyqYNcKo/hqdefault.jpg);&quot; width=&quot;480&quot;&gt;&lt;/iframe&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Deploying WordPress on IIS requires you to configure IIS Manager to handle PHP requests. In order to handle PHP requests enable CGI module from windows features. Install PHP package and register in IIS Manager using PHP Manager for IIS, which is a tool to manage different versions of PHP.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gcsujai.blogspot.com/feeds/1404290864685351930/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2275808999334860244/1404290864685351930' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/1404290864685351930'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/1404290864685351930'/><link rel='alternate' type='text/html' href='http://gcsujai.blogspot.com/2024/02/install-wordpress-on-iis-internet.html' title='Install WordPress on IIS (Internet Information Services)'/><author><name>Sujai GC</name><uri>http://www.blogger.com/profile/17693804644569493968</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/PY_VyqYNcKo/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2275808999334860244.post-509718087832788590</id><published>2024-02-14T21:52:00.004+05:30</published><updated>2024-04-04T19:53:44.712+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="HTML"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><title type='text'>Configure Visual Studio Code for PHP development using IIS Express</title><content type='html'>&lt;h2 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;Setup VS Code for PHP Development using IIS Express&lt;/span&gt;&lt;/h2&gt;&lt;div&gt;Visual studio code has been the preferred IDE for software development among the developers and the most popular because of the support for building software in multiple languages and platforms, third-party extensions that boosts productivity. Developing PHP applications in visual studio code requires configuring it to handle PHP requests.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;First, you need to have PHP installed on your machine. In VS Code, open the settings and set the path to the PHP executable in the validation setting.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Next, to configure IIS Express settings download and install IIS Express which is a lightweight web server for development purposes. In the VS Code settings set the path to the executable for both iisexpress Appcmd and iisexpress.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;iframe frameborder=&quot;0&quot; height=&quot;270&quot; src=&quot;https://youtube.com/embed/lq8pmOmgaTE?si=AykCjSGFDaiD3WL_&quot; style=&quot;background-image: url(https://i.ytimg.com/vi/lq8pmOmgaTE/hqdefault.jpg);&quot; width=&quot;480&quot;&gt;&lt;/iframe&gt;</content><link rel='replies' type='application/atom+xml' href='http://gcsujai.blogspot.com/feeds/509718087832788590/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2275808999334860244/509718087832788590' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/509718087832788590'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/509718087832788590'/><link rel='alternate' type='text/html' href='http://gcsujai.blogspot.com/2024/02/configure-visual-studio-code-for-php.html' title='Configure Visual Studio Code for PHP development using IIS Express'/><author><name>Sujai GC</name><uri>http://www.blogger.com/profile/17693804644569493968</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/lq8pmOmgaTE/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2275808999334860244.post-4138932581231788853</id><published>2024-02-12T11:07:00.003+05:30</published><updated>2024-04-04T19:57:23.065+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Group Replication"/><category scheme="http://www.blogger.com/atom/ns#" term="InnoDB"/><category scheme="http://www.blogger.com/atom/ns#" term="MySQL"/><title type='text'>MySQL InnoDB Cluster - Configure MySQL Instances and create InnoDB cluster</title><content type='html'>&lt;h2 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;Configure MySQL Instances and create InnoDB cluster&lt;/span&gt;&lt;/h2&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;iframe frameborder=&quot;0&quot; height=&quot;270&quot; src=&quot;https://youtube.com/embed/aNM5gfoX-oI?si=FtoXJ6DhKtkd0uS8&quot; width=&quot;480&quot;&gt;&lt;/iframe&gt;</content><link rel='replies' type='application/atom+xml' href='http://gcsujai.blogspot.com/feeds/4138932581231788853/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2275808999334860244/4138932581231788853' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/4138932581231788853'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/4138932581231788853'/><link rel='alternate' type='text/html' href='http://gcsujai.blogspot.com/2024/02/mysql-innodb-cluster-part-2-configure.html' title='MySQL InnoDB Cluster - Configure MySQL Instances and create InnoDB cluster'/><author><name>Sujai GC</name><uri>http://www.blogger.com/profile/17693804644569493968</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/aNM5gfoX-oI/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2275808999334860244.post-150746983840214223</id><published>2024-02-12T10:16:00.004+05:30</published><updated>2024-04-04T19:58:58.417+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="InnoDB"/><category scheme="http://www.blogger.com/atom/ns#" term="MySQL"/><title type='text'>MySQL InnoDB Cluster - Install MySQL and create multiple instances</title><content type='html'>&lt;h2 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: arial;&quot;&gt;Create multiple instances of MySQL server locally&lt;/span&gt;&lt;/h2&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;iframe frameborder=&quot;0&quot; height=&quot;270&quot; src=&quot;https://youtube.com/embed/n3aTthK7duk?si=djQ7NN0tII81zFMd&quot; style=&quot;background-image: url(https://i.ytimg.com/vi/n3aTthK7duk/hqdefault.jpg);&quot; width=&quot;480&quot;&gt;&lt;/iframe&gt;</content><link rel='replies' type='application/atom+xml' href='http://gcsujai.blogspot.com/feeds/150746983840214223/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2275808999334860244/150746983840214223' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/150746983840214223'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/150746983840214223'/><link rel='alternate' type='text/html' href='http://gcsujai.blogspot.com/2024/02/install-mysql-and-create-multiple.html' title='MySQL InnoDB Cluster - Install MySQL and create multiple instances'/><author><name>Sujai GC</name><uri>http://www.blogger.com/profile/17693804644569493968</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/n3aTthK7duk/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2275808999334860244.post-3135427745740861101</id><published>2021-08-20T19:18:00.004+05:30</published><updated>2021-08-20T19:22:12.978+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="HTML"/><category scheme="http://www.blogger.com/atom/ns#" term="Jquery"/><title type='text'>Trigger function in DIV</title><content type='html'>&lt;h2 style=&quot;text-align: left;&quot;&gt;&amp;nbsp;How to trigger function in DIV&lt;/h2&gt;&lt;div&gt;The events in the object fires when the page loads, mouse events , keyboard events and other types of inputs. It is not possible to trigger an event in the DIV for example, onload event when the object is loaded. Some elements like body, script, link, image, style support firing up of events. However, it is required for the developer to trigger the event in object DIV. In order to do that we can use jquery trigger method to fire the event.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;HTML&lt;/h3&gt;&lt;div&gt;&lt;div&gt;&amp;lt;div onload=&quot;$(this).text(&#39;I will display in Div using text()&#39;);&quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;/div&gt;&lt;div&gt;&amp;lt;div onload=&quot;welcome()&quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Javascript/Jquery&lt;/h3&gt;&lt;div&gt;&lt;div&gt;function welcome(){&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;alert(&#39;Hello world! in func welcome&#39;);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;$(function(){&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;$(&#39;div[onload]&#39;).trigger(&#39;onload&#39;);&lt;/div&gt;&lt;div&gt;});&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gcsujai.blogspot.com/feeds/3135427745740861101/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2275808999334860244/3135427745740861101' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/3135427745740861101'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/3135427745740861101'/><link rel='alternate' type='text/html' href='http://gcsujai.blogspot.com/2021/08/trigger-function-in-div.html' title='Trigger function in DIV'/><author><name>Sujai GC</name><uri>http://www.blogger.com/profile/17693804644569493968</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2275808999334860244.post-2892190985951156932</id><published>2020-09-11T14:38:00.001+05:30</published><updated>2020-09-11T14:38:42.657+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="MS SQL"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><category scheme="http://www.blogger.com/atom/ns#" term="T-SQL"/><title type='text'>Move column data from one table to another</title><content type='html'>There may be situations when you want to move MYSQL column data from one table to another.&amp;nbsp;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;MySQL Query:&lt;/b&gt;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;UPDATE accounts_users, accounts_membership&amp;nbsp; SET accounts_users.username=accounts_membership.username WHERE accounts_users.user_id=accounts_membership.user_id AND accounts_users.user_id &amp;gt;= 1;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gcsujai.blogspot.com/feeds/2892190985951156932/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2275808999334860244/2892190985951156932' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/2892190985951156932'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/2892190985951156932'/><link rel='alternate' type='text/html' href='http://gcsujai.blogspot.com/2020/09/move-column-data-from-one-table-to.html' title='Move column data from one table to another'/><author><name>Sujai GC</name><uri>http://www.blogger.com/profile/17693804644569493968</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2275808999334860244.post-8687637293329616387</id><published>2020-06-04T12:30:00.002+05:30</published><updated>2020-06-26T09:51:48.278+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="MS SQL"/><category scheme="http://www.blogger.com/atom/ns#" term="T-SQL"/><title type='text'>Retrieve duplicate column values in MySQL</title><content type='html'>&lt;h1 style=&quot;text-align: left;&quot;&gt;How to find duplicate column values in MySQL&lt;/h1&gt;&lt;p&gt;Let&#39;s see some of the many ways to retrieve duplicate column value from MySQL table. In this example, we are going to find and return duplicate contact names from the contacts table. It is up to you to decide which is applicable according to the scenario.&lt;/p&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-2355145822321293&quot;
     data-ad-slot=&quot;2835403633&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;u&gt;Approach 1:&lt;/u&gt;&lt;/h3&gt;&lt;div&gt;SELECT customer_name FROM contacts group by customer_name having count(*) &amp;gt; 1;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;OR&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;SELECT&amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; customer_name,&amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; COUNT(customer_name)&lt;/div&gt;&lt;div&gt;FROM&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; contacts&lt;/div&gt;&lt;div&gt;GROUP BY customer_name&lt;/div&gt;&lt;div&gt;HAVING COUNT(customer_name) &amp;gt; 1;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Result:&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpZYOwYPVA6aF8tWycn6LpD9GEJ8xpqSHFbv5fgFEpB9qnIp8uyF93ApidNRb7cRlJyCRE3FKPQivC2unHytRa-Uqsyz-ttHojdSaq6TtmlwXgQg4E1LE9D0Na070NuZ3Z90ZZPqp5BRw/s260/contacts-multiple.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;94&quot; data-original-width=&quot;260&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpZYOwYPVA6aF8tWycn6LpD9GEJ8xpqSHFbv5fgFEpB9qnIp8uyF93ApidNRb7cRlJyCRE3FKPQivC2unHytRa-Uqsyz-ttHojdSaq6TtmlwXgQg4E1LE9D0Na070NuZ3Z90ZZPqp5BRw/&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;u&gt;Approach 2:&lt;/u&gt;&lt;/h3&gt;&lt;div&gt;&lt;div&gt;SELECT contact_id,&amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp;contact_type,&amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp;contacts.customer_name&amp;nbsp;&lt;/div&gt;&lt;div&gt;FROM contacts&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp;INNER JOIN (SELECT customer_name&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;FROM&amp;nbsp; &amp;nbsp;contacts&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;GROUP&amp;nbsp; BY customer_name&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;HAVING COUNT(contact_id) &amp;gt; 1) dup&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ON contacts.customer_name = dup.customer_name;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Result:&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAvpQ1FN1wxHfvb7lPoAN_SJzyh9w-tJixev9EnIvuU9kzOsVh6k3G9kUXqq_Ubgpjbgqx6-6zhk06zJaiZe5K93DAdQH_IG2JbPm378hrSxqZk62LvgdNnyynM28T2togGSNiLAy5AQI/s273/contact-duplicates.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;161&quot; data-original-width=&quot;273&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAvpQ1FN1wxHfvb7lPoAN_SJzyh9w-tJixev9EnIvuU9kzOsVh6k3G9kUXqq_Ubgpjbgqx6-6zhk06zJaiZe5K93DAdQH_IG2JbPm378hrSxqZk62LvgdNnyynM28T2togGSNiLAy5AQI/&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gcsujai.blogspot.com/feeds/8687637293329616387/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2275808999334860244/8687637293329616387' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/8687637293329616387'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/8687637293329616387'/><link rel='alternate' type='text/html' href='http://gcsujai.blogspot.com/2020/06/finding-duplicate-column-values-in-mysql.html' title='Retrieve duplicate column values in MySQL'/><author><name>Sujai GC</name><uri>http://www.blogger.com/profile/17693804644569493968</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpZYOwYPVA6aF8tWycn6LpD9GEJ8xpqSHFbv5fgFEpB9qnIp8uyF93ApidNRb7cRlJyCRE3FKPQivC2unHytRa-Uqsyz-ttHojdSaq6TtmlwXgQg4E1LE9D0Na070NuZ3Z90ZZPqp5BRw/s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2275808999334860244.post-4035952142173340104</id><published>2020-05-25T09:39:00.002+05:30</published><updated>2020-06-01T08:58:37.765+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="HTML"/><category scheme="http://www.blogger.com/atom/ns#" term="Jquery"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><title type='text'>Export to excel using PHP and Jquery</title><content type='html'>&lt;h1 style=&quot;text-align: left;&quot;&gt;Export to excel using PHP and Jquery&lt;/h1&gt;&lt;p&gt;In order to export MySQL table data to excel let&#39;s create a HTML page and put two anchor tags, one is to export to excel and the other to export to CSV (Comma Seperated Value). Write a jquery function to submit the form which makes call to the PHP function to export data returned to excel.&lt;/p&gt;&lt;b&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;HTML Page&lt;/b&gt;&lt;div&gt;&lt;pre style=&quot;background: white; font-family: consolas; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;form&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;site&quot;&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;method&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;post&quot;&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;enctype&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;multipart/form-data&quot;&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;a&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;studentsExportExcel&quot;&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;href&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;javascript:void(0)&quot;&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;onclick&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;&lt;/span&gt;exportExcel&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;Export to excel (.xls)&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;a&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;a&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;studentsExportCSV&quot;&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;href&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;javascript:void(0)&quot;&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;onclick&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;&lt;/span&gt;exportExcel&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;Export to csv&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;a&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;input&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;hidden&quot;&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;&quot;&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;hidden-type&quot;&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;studentsExportType&quot;&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;form&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style=&quot;background: white; font-family: consolas; font-size: 10pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;; font-size: medium; white-space: normal;&quot;&gt;&lt;b&gt;Jquery&lt;/b&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background: white; font-family: consolas; font-size: 10pt;&quot;&gt;&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: consolas; font-size: 10pt;&quot;&gt;$&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;document&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt;.ready&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;()&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt;
	&lt;span style=&quot;color: #4f76ac;&quot;&gt;function&lt;/span&gt; exportExcel&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;obj&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt;
    	&lt;span style=&quot;color: #4f76ac;&quot;&gt;var&lt;/span&gt; target &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; $&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;obj&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt;.attr&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&#39;id&#39;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;);&lt;/span&gt;
    	&lt;span style=&quot;color: #4f76ac;&quot;&gt;switch&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;target&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #4f76ac;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #823125;&quot;&gt;&#39;studentsExportExcel&#39;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;:&lt;/span&gt;
        &lt;span style=&quot;color: #4f76ac;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #823125;&quot;&gt;&#39;studentsExportCSV&#39;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;:&lt;/span&gt;
            $&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&#39;#hidden-type&#39;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt;.val&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;target&lt;span style=&quot;color: #1e7c70;&quot;&gt;);&lt;/span&gt;
            $&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&#39;#site&#39;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt;.submit&lt;span style=&quot;color: #1e7c70;&quot;&gt;();&lt;/span&gt;
            $&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&#39;#hidden-type&#39;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt;.val&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;);&lt;/span&gt;
            &lt;span style=&quot;color: #4f76ac;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
    	&lt;span style=&quot;color: #1e7c70;&quot;&gt;}&lt;/span&gt;
	&lt;span style=&quot;color: #1e7c70;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: #1e7c70;&quot;&gt;});&lt;/span&gt;
&lt;/pre&gt;&lt;/pre&gt;&lt;pre style=&quot;background: white; font-family: consolas; font-size: 10pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;; font-size: medium; white-space: normal;&quot;&gt;&lt;b&gt;PHP Function&lt;/b&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background: white; font-family: consolas; font-size: 10pt;&quot;&gt;&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: consolas; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #4f76ac;&quot;&gt;function&lt;/span&gt; students&lt;span style=&quot;color: #1e7c70;&quot;&gt;()&lt;/span&gt;
    &lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #4f76ac;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;isset&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #9b5f9b;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&quot;studentsExportType&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;]))&lt;/span&gt;
        &lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #4f76ac;&quot;&gt;switch&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #9b5f9b;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&quot;studentsExportType&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;])&lt;/span&gt;
            &lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: #4f76ac;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #823125;&quot;&gt;&quot;studentsExportExcel&quot;&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;:&lt;/span&gt;
                    &lt;span style=&quot;color: #46830d;&quot;&gt;// Submission from&lt;/span&gt;
                    &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$filename&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #823125;&quot;&gt;&quot;students&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;.&lt;/span&gt; &lt;span style=&quot;color: #222222;&quot;&gt;date&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&#39;dMY&#39;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&quot;.xls&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;       
                    &lt;span style=&quot;color: #222222;&quot;&gt;header&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&quot;Content-Type: application/vnd.ms-excel&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;);&lt;/span&gt;
                    &lt;span style=&quot;color: #222222;&quot;&gt;header&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&quot;Content-Disposition: attachment; filename=\&quot;&lt;/span&gt;&lt;span style=&quot;color: #9b5f9b;&quot;&gt;$filename&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;\&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;);&lt;/span&gt;
                    students_export_excel&lt;span style=&quot;color: #1e7c70;&quot;&gt;();&lt;/span&gt;
                    &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&quot;studentsExportType&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #823125;&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
                    &lt;span style=&quot;color: #4f76ac;&quot;&gt;exit&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;();&lt;/span&gt;
                &lt;span style=&quot;color: #4f76ac;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #823125;&quot;&gt;&quot;studentsExportCSV&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;:&lt;/span&gt;
                    &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$filename&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #823125;&quot;&gt;&quot;students&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;.&lt;/span&gt; &lt;span style=&quot;color: #222222;&quot;&gt;date&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&#39;dMY&#39;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;.&lt;/span&gt; &lt;span style=&quot;color: #823125;&quot;&gt;&quot;.csv&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
                    &lt;span style=&quot;color: #222222;&quot;&gt;header&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&quot;Content-type: application/csv&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;);&lt;/span&gt;
                    &lt;span style=&quot;color: #222222;&quot;&gt;header&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&quot;Content-Disposition: attachment; filename=\&quot;&lt;/span&gt;&lt;span style=&quot;color: #9b5f9b;&quot;&gt;$filename&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;\&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;);&lt;/span&gt;
                    &lt;span style=&quot;color: #222222;&quot;&gt;header&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&quot;Pragma: no-cache&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;);&lt;/span&gt;
                    &lt;span style=&quot;color: #222222;&quot;&gt;header&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&quot;Expires: 0&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;);&lt;/span&gt;

                    &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$handle&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #222222;&quot;&gt;fopen&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&#39;php://output&#39;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #823125;&quot;&gt;&#39;w&#39;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;);&lt;/span&gt;
                    &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$data&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; get_students&lt;span style=&quot;color: #1e7c70;&quot;&gt;();&lt;/span&gt;
                    &lt;span style=&quot;color: #4f76ac;&quot;&gt;foreach&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #9b5f9b;&quot;&gt;$data&lt;/span&gt; &lt;span style=&quot;color: #4f76ac;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$data&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt;
                    &lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt;
                        &lt;span style=&quot;color: #222222;&quot;&gt;fputcsv&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #9b5f9b;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$data&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;);&lt;/span&gt;
                    &lt;span style=&quot;color: #1e7c70;&quot;&gt;}&lt;/span&gt;
                    &lt;span style=&quot;color: #222222;&quot;&gt;fclose&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #9b5f9b;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;);&lt;/span&gt;
                    &lt;span style=&quot;color: #4f76ac;&quot;&gt;exit&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;();&lt;/span&gt;
                &lt;span style=&quot;color: #4f76ac;&quot;&gt;default&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;:&lt;/span&gt;
                    &lt;span style=&quot;color: #4f76ac;&quot;&gt;die&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&quot;Unknown action : &quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #9b5f9b;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&quot;action&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;]);&lt;/span&gt;
                    &lt;span style=&quot;color: #4f76ac;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: #1e7c70;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: #1e7c70;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: #1e7c70;&quot;&gt;}&lt;/span&gt;


&lt;span style=&quot;color: #4f76ac;&quot;&gt;function&lt;/span&gt; students_export_excel&lt;span style=&quot;color: #1e7c70;&quot;&gt;()&lt;/span&gt;
    &lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$heading&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #222222;&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$students&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; get_students&lt;span style=&quot;color: #1e7c70;&quot;&gt;();&lt;/span&gt;
        
        &lt;span style=&quot;color: #4f76ac;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;(!&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;empty&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #9b5f9b;&quot;&gt;$students&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;))&lt;/span&gt;
          &lt;span style=&quot;color: #4f76ac;&quot;&gt;foreach&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #9b5f9b;&quot;&gt;$students&lt;/span&gt; &lt;span style=&quot;color: #4f76ac;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #4f76ac;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;(!&lt;/span&gt;&lt;span style=&quot;color: #9b5f9b;&quot;&gt;$heading&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt;
              &lt;span style=&quot;color: #46830d;&quot;&gt;// display field/column names as a first row&lt;/span&gt;
              &lt;span style=&quot;color: #4f76ac;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #222222;&quot;&gt;implode&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&quot;\t&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #222222;&quot;&gt;array_keys&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #9b5f9b;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;))&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;.&lt;/span&gt; &lt;span style=&quot;color: #823125;&quot;&gt;&quot;\n&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
              &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$heading&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #222222;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: #1e7c70;&quot;&gt;}&lt;/span&gt;
            &lt;span style=&quot;color: #4f76ac;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #222222;&quot;&gt;implode&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&quot;\t&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #222222;&quot;&gt;array_values&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #9b5f9b;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;))&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;.&lt;/span&gt; &lt;span style=&quot;color: #823125;&quot;&gt;&quot;\n&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
          &lt;span style=&quot;color: #1e7c70;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: #4f76ac;&quot;&gt;exit&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #1e7c70;&quot;&gt;}&lt;/span&gt;


&lt;span style=&quot;color: #4f76ac;&quot;&gt;function&lt;/span&gt; get_students&lt;span style=&quot;color: #1e7c70;&quot;&gt;()&lt;/span&gt;
&lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$servername&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #823125;&quot;&gt;&quot;localhost&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$username&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #823125;&quot;&gt;&quot;username&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$password&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #823125;&quot;&gt;&quot;password&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$dbname&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #823125;&quot;&gt;&quot;myDB&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
 
        &lt;span style=&quot;color: #46830d;&quot;&gt;// Create connection&lt;/span&gt;
        &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$conn&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #4f76ac;&quot;&gt;new&lt;/span&gt; mysqli&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #9b5f9b;&quot;&gt;$servername&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$username&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$password&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$dbname&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;);&lt;/span&gt;
        &lt;span style=&quot;color: #46830d;&quot;&gt;// Check connection&lt;/span&gt;
        &lt;span style=&quot;color: #4f76ac;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #9b5f9b;&quot;&gt;$conn&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;-&amp;gt;&lt;/span&gt;connect_error&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #4f76ac;&quot;&gt;die&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&quot;Connection failed: &quot;&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;.&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$conn&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;-&amp;gt;&lt;/span&gt;connect_error&lt;span style=&quot;color: #1e7c70;&quot;&gt;);&lt;/span&gt;
        &lt;span style=&quot;color: #1e7c70;&quot;&gt;}&lt;/span&gt;
 
        &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$sql&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #823125;&quot;&gt;&quot;SELECT id, firstname, lastname FROM students&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$result&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$conn&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;-&amp;gt;&lt;/span&gt;query&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #9b5f9b;&quot;&gt;$sql&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;);&lt;/span&gt;
 
        &lt;span style=&quot;color: #4f76ac;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #1e7c70;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/pre&gt;&lt;pre style=&quot;background: white; font-family: consolas; font-size: 10pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;; font-size: medium; white-space: normal;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gcsujai.blogspot.com/feeds/4035952142173340104/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2275808999334860244/4035952142173340104' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/4035952142173340104'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/4035952142173340104'/><link rel='alternate' type='text/html' href='http://gcsujai.blogspot.com/2020/05/export-to-excel-using-php-and-jquery.html' title='Export to excel using PHP and Jquery'/><author><name>Sujai GC</name><uri>http://www.blogger.com/profile/17693804644569493968</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2275808999334860244.post-1838975376498044573</id><published>2020-05-18T20:31:00.008+05:30</published><updated>2025-12-28T11:58:22.323+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="MS SQL"/><category scheme="http://www.blogger.com/atom/ns#" term="T-SQL"/><title type='text'> Sum columns in multiple tables - MySQL</title><content type='html'>&lt;h1&gt;How to sum columns in multiple tables in MySQL&lt;/h1&gt;&lt;p&gt;We will see two methods to sum columns from multiple tables. The first method is more preferred than the second method. Therefore consider using first approach.&lt;/p&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;
&lt;script async=&quot;&quot; src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-2355145822321293&quot; data-ad-format=&quot;fluid&quot; data-ad-layout=&quot;in-article&quot; data-ad-slot=&quot;2835403633&quot; style=&quot;display: block; text-align: center;&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;div&gt;METHOD 1:&lt;/div&gt;&lt;div&gt;&lt;pre style=&quot;text-align: left;&quot;&gt;SELECT credit.contact_id, (IFNULL(credit, 0) - IFNULL(debit, 0)) as balance&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;FROM (&lt;br /&gt;&amp;nbsp; &amp;nbsp; (SELECT SUM(credit) as credit, contact_id FROM table_a GROUP BY contact_id) as credit&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;LEFT JOIN&lt;br /&gt;&amp;nbsp; &amp;nbsp; (SELECT SUM(debit) as debit, contact_id FROM table_b GROUP BY contact_id) as debit&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;ON debit.contact_id = credit.contact_id);&lt;/pre&gt;&lt;pre style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;; white-space: normal;&quot;&gt;METHOD 2:&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;text-align: left;&quot;&gt;SELECT contact_id, SUM(balance) FROM
    (SELECT contact_id ,credit as balance FROM table_a
       UNION ALL
    SELECT contact_id,- debit as balance FROM table_b
   ) as x
  GROUP BY contact_id;&lt;/pre&gt;&lt;pre style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;background-color: #ffa400;&quot;&gt;Ads&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;text-align: left;&quot;&gt;&lt;a href=&quot;https://amzn.to/44MUMin&quot; target=&quot;_blank&quot;&gt;Serplex® 180-IN-1 Precision Screwdriver Set with 3 Torque Modes and 162 Magnetic Precision Bits&lt;/a&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;text-align: left;&quot;&gt;&lt;a href=&quot;https://amzn.to/4qNEX3J&quot; target=&quot;_blank&quot;&gt;XERGY LED Desk Lamp with USB Charging Output – Dimmable, Touch Control, Timer, Night Mode, 5 Color Modes&lt;/a&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gcsujai.blogspot.com/feeds/1838975376498044573/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2275808999334860244/1838975376498044573' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/1838975376498044573'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/1838975376498044573'/><link rel='alternate' type='text/html' href='http://gcsujai.blogspot.com/2020/05/sum-columns-in-multiple-tables-mysql.html' title=' Sum columns in multiple tables - MySQL'/><author><name>Sujai GC</name><uri>http://www.blogger.com/profile/17693804644569493968</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2275808999334860244.post-2245784085993837123</id><published>2020-05-02T14:24:00.004+05:30</published><updated>2020-06-26T09:50:41.748+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="HTML"/><category scheme="http://www.blogger.com/atom/ns#" term="Jquery"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><title type='text'>Infinite scroll for div element</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h1&gt;Infinite scroll loading for div element&lt;/h1&gt;
&lt;p&gt;This article explains how to incrementally load items as you scroll down div element in the page. In this example a HTML page is created with an unordered list element where the list items returned by the function gets appended. Here difference of the scroll height of the div container and its client height is compared against the scroll top offset value.&lt;/p&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-2355145822321293&quot;
     data-ad-slot=&quot;2835403633&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;b&gt;HTML Page&lt;/b&gt;&lt;br /&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial;&quot;&gt;&lt;pre style=&quot;background: white; font-family: consolas; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;
  &amp;lt;&lt;span style=&quot;color: #823125; font-family: consolas; font-size: 10pt;&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;font-family: consolas; font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #cf4820; font-family: consolas; font-size: 10pt;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: #4f76ac; font-family: consolas; font-size: 10pt;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac; font-family: consolas; font-size: 10pt;&quot;&gt;&quot;containerName&quot;&lt;/span&gt; &lt;span style=&quot;color: #cf4820; font-family: consolas; font-size: 10pt;&quot;&gt;style&lt;/span&gt;&lt;span style=&quot;color: #4f76ac; font-family: consolas; font-size: 10pt;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac; font-family: consolas; font-size: 10pt;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #cf4820; font-family: consolas; font-size: 10pt;&quot;&gt;overflow&lt;/span&gt;&lt;span style=&quot;font-family: consolas; font-size: 10pt;&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color: #4f76ac; font-family: consolas; font-size: 10pt;&quot;&gt;scroll&lt;/span&gt;&lt;span style=&quot;font-family: consolas; font-size: 10pt;&quot;&gt;;&lt;/span&gt;height&lt;span style=&quot;font-family: consolas; font-size: 10pt;&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color: #4f76ac; font-family: consolas; font-size: 10pt;&quot;&gt;500&lt;/span&gt;&lt;span style=&quot;color: #4f76ac; font-family: consolas; font-size: 10pt;&quot;&gt;px&lt;/span&gt;&lt;span style=&quot;font-family: consolas; font-size: 10pt;&quot;&gt;;&lt;/span&gt;&quot;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #823125; font-family: consolas; font-size: 10pt;&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #4f76ac; font-family: consolas; font-size: 10pt;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background: white; font-family: consolas; font-size: 10pt;&quot;&gt;&lt;font color=&quot;#4f76ac&quot;&gt;  &lt;/font&gt;&amp;lt;&lt;span style=&quot;color: #823125; font-size: 10pt;&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #cf4820; font-size: 10pt;&quot;&gt;style&lt;/span&gt;&lt;span style=&quot;color: #4f76ac; font-size: 10pt;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac; font-size: 10pt;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #cf4820; font-size: 10pt;&quot;&gt;text-align&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color: #4f76ac; font-size: 10pt;&quot;&gt;center&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: #4f76ac; font-size: 10pt;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #4f76ac; font-size: 10pt;&quot;&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #823125; font-size: 10pt;&quot;&gt;img&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #cf4820; font-size: 10pt;&quot;&gt;alt&lt;/span&gt;&lt;span style=&quot;color: #4f76ac; font-size: 10pt;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac; font-size: 10pt;&quot;&gt;&quot;Loading...&quot;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #cf4820; font-size: 10pt;&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;color: #4f76ac; font-size: 10pt;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac; font-size: 10pt;&quot;&gt;&quot;../assets/images/svg/three-dots.svg&quot;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #cf4820; font-size: 10pt;&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #4f76ac; font-size: 10pt;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac; font-size: 10pt;&quot;&gt;&quot;loading-info&quot;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4f76ac; font-size: 10pt;&quot;&gt;/&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #823125; font-size: 10pt;&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #4f76ac; font-size: 10pt;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background: white; font-family: consolas; font-size: 10pt;&quot;&gt;  &lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;notifyMessage&quot;&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background: white;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: times, &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;Jquery&lt;/span&gt;&lt;/b&gt;&lt;/pre&gt;&lt;pre style=&quot;background: white; font-size: 10pt; line-height: 1;&quot;&gt;&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: consolas; font-size: 10pt;&quot;&gt;$&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;document&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt;.ready&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;()&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: consolas; font-size: 10pt; line-height: 1;&quot;&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;  &lt;/span&gt;var&lt;span style=&quot;font-size: 10pt; line-height: 1;&quot;&gt; offset &lt;/span&gt;&lt;span style=&quot;color: #1e7c70; font-size: 10pt; line-height: 1;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; line-height: 1;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9b5f9b; font-size: 10pt; line-height: 1;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #1e7c70; font-size: 10pt; line-height: 1;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: consolas; font-size: 10pt; line-height: 1;&quot;&gt;  &lt;span style=&quot;color: #4f76ac; line-height: 1;&quot;&gt;var&lt;/span&gt; loading &lt;span style=&quot;color: #1e7c70; line-height: 1;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b; line-height: 1;&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;color: #1e7c70; line-height: 1;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: consolas; font-size: 10pt; line-height: 1;&quot;&gt;&lt;span style=&quot;color: #1e7c70; line-height: 1;&quot;&gt;  &lt;/span&gt;$&lt;span style=&quot;color: #1e7c70; font-size: 10pt; line-height: 1;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125; font-size: 10pt; line-height: 1;&quot;&gt;&#39;.loading-info&#39;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70; font-size: 10pt; line-height: 1;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; line-height: 1;&quot;&gt;.hide&lt;/span&gt;&lt;span style=&quot;color: #1e7c70; font-size: 10pt; line-height: 1;&quot;&gt;();&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: consolas; font-size: 10pt; line-height: 1;&quot;&gt;  appendItems&lt;span style=&quot;color: #1e7c70; line-height: 1;&quot;&gt;(&lt;/span&gt;offset&lt;span style=&quot;color: #1e7c70; line-height: 1;&quot;&gt;,&lt;/span&gt; loading&lt;span style=&quot;color: #1e7c70; line-height: 1;&quot;&gt;);&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: consolas; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;  &lt;/span&gt;$&lt;span style=&quot;color: #1e7c70; font-size: 10pt;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;window&lt;/span&gt;&lt;span style=&quot;color: #1e7c70; font-size: 10pt;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;.scroll&lt;/span&gt;&lt;span style=&quot;color: #1e7c70; font-size: 10pt;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #4f76ac; font-size: 10pt;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #1e7c70; font-size: 10pt;&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #1e7c70; font-size: 10pt;&quot;&gt;{&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: consolas; font-size: 10pt;&quot;&gt;        &lt;span style=&quot;color: #4f76ac;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;$&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&#39;#notifyMessage&#39;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt;.html&lt;span style=&quot;color: #1e7c70;&quot;&gt;()&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;===&lt;/span&gt; &lt;span style=&quot;color: #823125;&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt;
            var&lt;span style=&quot;font-family: consolas; font-size: 10pt;&quot;&gt; divHeight &lt;/span&gt;&lt;span style=&quot;color: #1e7c70; font-family: consolas; font-size: 10pt;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;font-family: consolas; font-size: 10pt;&quot;&gt; $&lt;/span&gt;&lt;span style=&quot;color: #1e7c70; font-family: consolas; font-size: 10pt;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125; font-family: consolas; font-size: 10pt;&quot;&gt;&#39;#containerName&#39;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70; font-family: consolas; font-size: 10pt;&quot;&gt;)[&lt;/span&gt;&lt;span style=&quot;color: #9b5f9b; font-family: consolas; font-size: 10pt;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #1e7c70; font-family: consolas; font-size: 10pt;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;font-family: consolas; font-size: 10pt;&quot;&gt;.scrollHeight &lt;/span&gt;&lt;span style=&quot;color: #1e7c70; font-family: consolas; font-size: 10pt;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;font-family: consolas; font-size: 10pt;&quot;&gt; $&lt;/span&gt;&lt;span style=&quot;color: #1e7c70; font-family: consolas; font-size: 10pt;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125; font-family: consolas; font-size: 10pt;&quot;&gt;&#39;#containerName&#39;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70; font-family: consolas; font-size: 10pt;&quot;&gt;)[&lt;/span&gt;&lt;span style=&quot;color: #9b5f9b; font-family: consolas; font-size: 10pt;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #1e7c70; font-family: consolas; font-size: 10pt;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;font-family: consolas; font-size: 10pt;&quot;&gt;.clientHeight&lt;/span&gt;&lt;span style=&quot;color: #1e7c70; font-family: consolas; font-size: 10pt;&quot;&gt;;&lt;/span&gt;&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: consolas; font-size: 10pt;&quot;&gt;            &lt;span style=&quot;color: #4f76ac;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;$&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&#39;#containerName&#39;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt;.scrollTop&lt;span style=&quot;color: #1e7c70;&quot;&gt;()&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;===&lt;/span&gt; divHeight&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt;&lt;/pre&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;offset &lt;span style=&quot;color: #1e7c70;&quot;&gt;+=&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;20&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
                appendItems&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;offset&lt;span style=&quot;color: #1e7c70;&quot;&gt;,&lt;/span&gt; loading&lt;span style=&quot;color: #1e7c70;&quot;&gt;);&lt;/span&gt;
            &lt;span style=&quot;color: #1e7c70;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: #1e7c70;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: #1e7c70;&quot;&gt;});&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: consolas; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;});&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: consolas; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;function&lt;/span&gt; appendItems&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;offset&lt;span style=&quot;color: #1e7c70;&quot;&gt;,&lt;/span&gt; loading&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #4f76ac;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;loading &lt;span style=&quot;color: #1e7c70;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt;
        loading &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
        $&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&#39;.loading-info&#39;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt;.show&lt;span style=&quot;color: #1e7c70;&quot;&gt;();&lt;/span&gt;
        $.post&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&#39;/admin/items/append&#39;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt; &lt;span style=&quot;color: #823125;&quot;&gt;&#39;offset&#39;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;:&lt;/span&gt; offset &lt;span style=&quot;color: #1e7c70;&quot;&gt;},&lt;/span&gt; &lt;span style=&quot;color: #4f76ac;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;data&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt;
            loading &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: #4f76ac;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;data.trim&lt;span style=&quot;color: #1e7c70;&quot;&gt;()&lt;/span&gt;.length &lt;span style=&quot;color: #1e7c70;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt;
                $&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&#39;.loading-info&#39;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt;.hide&lt;span style=&quot;color: #1e7c70;&quot;&gt;();&lt;/span&gt;
                $&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&#39;#notifyMessage&#39;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt;.html&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&#39;&amp;lt;p&amp;gt; End of records&amp;lt;/p&amp;gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;);&lt;/span&gt;
                &lt;span style=&quot;color: #4f76ac;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: #1e7c70;&quot;&gt;}&lt;/span&gt;
            $&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&#39;.loading-info&#39;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt;.hide&lt;span style=&quot;color: #1e7c70;&quot;&gt;();&lt;/span&gt;
 
            $&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&quot;#containerName&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt;.append&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;data&lt;span style=&quot;color: #1e7c70;&quot;&gt;);&lt;/span&gt;
        &lt;span style=&quot;color: #1e7c70;&quot;&gt;})&lt;/span&gt;.fail&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;xhr&lt;span style=&quot;color: #1e7c70;&quot;&gt;,&lt;/span&gt; ajaxOptions&lt;span style=&quot;color: #1e7c70;&quot;&gt;,&lt;/span&gt; thrownError&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt;
            alert&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;thrownError&lt;span style=&quot;color: #1e7c70;&quot;&gt;);&lt;/span&gt;
        &lt;span style=&quot;color: #1e7c70;&quot;&gt;})&lt;/span&gt;
    &lt;span style=&quot;color: #1e7c70;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: #1e7c70;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-size: 10pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: times, &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;PHP Function&lt;/span&gt;&lt;/b&gt;&lt;/pre&gt;&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: consolas; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;function&lt;/span&gt; append&lt;span style=&quot;color: #1e7c70;&quot;&gt;()&lt;/span&gt;
&lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$list&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #222222;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$offset&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&#39;offset&#39;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;];&lt;/span&gt;
        &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$servername&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #823125;&quot;&gt;&quot;localhost&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$username&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #823125;&quot;&gt;&quot;username&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$password&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #823125;&quot;&gt;&quot;password&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$dbname&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #823125;&quot;&gt;&quot;myDB&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
 
        &lt;span style=&quot;color: #46830d;&quot;&gt;// Create connection&lt;/span&gt;
        &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$conn&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #4f76ac;&quot;&gt;new&lt;/span&gt; mysqli&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #9b5f9b;&quot;&gt;$servername&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$username&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$password&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$dbname&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;);&lt;/span&gt;
        &lt;span style=&quot;color: #46830d;&quot;&gt;// Check connection&lt;/span&gt;
        &lt;span style=&quot;color: #4f76ac;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #9b5f9b;&quot;&gt;$conn&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;-&amp;gt;&lt;/span&gt;connect_error&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #4f76ac;&quot;&gt;die&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&quot;Connection failed: &quot;&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;.&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$conn&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;-&amp;gt;&lt;/span&gt;connect_error&lt;span style=&quot;color: #1e7c70;&quot;&gt;);&lt;/span&gt;
        &lt;span style=&quot;color: #1e7c70;&quot;&gt;}&lt;/span&gt;
 
        &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$sql&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #823125;&quot;&gt;&quot;SELECT id, firstname, lastname FROM employees limit &lt;/span&gt;&lt;span style=&quot;color: #9b5f9b;&quot;&gt;$offset&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;, 20&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$result&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$conn&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;-&amp;gt;&lt;/span&gt;query&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #9b5f9b;&quot;&gt;$sql&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;);&lt;/span&gt;
 
        &lt;span style=&quot;color: #4f76ac;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #9b5f9b;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;-&amp;gt;&lt;/span&gt;num_rows &lt;span style=&quot;color: #1e7c70;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #46830d;&quot;&gt;// output data of each row&lt;/span&gt;
            &lt;span style=&quot;color: #4f76ac;&quot;&gt;while&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #9b5f9b;&quot;&gt;$row&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;-&amp;gt;&lt;/span&gt;fetch_assoc&lt;span style=&quot;color: #1e7c70;&quot;&gt;())&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$list&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;+=&lt;/span&gt;  &lt;span style=&quot;color: #823125;&quot;&gt;&quot;&amp;lt;div&amp;gt;id: &quot;&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;.&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&quot;id&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;].&lt;/span&gt; &lt;span style=&quot;color: #823125;&quot;&gt;&quot; - Name: &quot;&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;.&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&quot;firstname&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;].&lt;/span&gt; &lt;span style=&quot;color: #823125;&quot;&gt;&quot; &quot;&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;.&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&quot;lastname&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;].&lt;/span&gt; &lt;span style=&quot;color: #823125;&quot;&gt;&quot;&amp;lt;/div&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: #1e7c70;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: #1e7c70;&quot;&gt;}&lt;/span&gt; 
        &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$conn&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;-&amp;gt;&lt;/span&gt;close&lt;span style=&quot;color: #1e7c70;&quot;&gt;();&lt;/span&gt;
 
        &lt;span style=&quot;color: #4f76ac;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$list&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #1e7c70;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/pre&gt;
&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://gcsujai.blogspot.com/feeds/2245784085993837123/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2275808999334860244/2245784085993837123' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/2245784085993837123'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/2245784085993837123'/><link rel='alternate' type='text/html' href='http://gcsujai.blogspot.com/2020/05/infinite-scroll-for-div-element.html' title='Infinite scroll for div element'/><author><name>Sujai GC</name><uri>http://www.blogger.com/profile/17693804644569493968</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2275808999334860244.post-5225460429042933012</id><published>2020-05-02T12:03:00.003+05:30</published><updated>2020-06-26T09:51:12.778+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="HTML"/><category scheme="http://www.blogger.com/atom/ns#" term="Jquery"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><title type='text'>Scroll Loading using Jquery and PHP</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h1 style=&quot;text-align: left;&quot;&gt;Scroll loading using jquery and PHP&lt;/h1&gt;
&lt;p&gt;This article explains how to incrementally load items as you scroll down the page. In this example a HTML page is created with an unordered list element where the list items returned by the function gets appended.&lt;/p&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-2355145822321293&quot;
     data-ad-slot=&quot;2835403633&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;b&gt;HTML Page&lt;/b&gt;&lt;br /&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial;&quot;&gt;&lt;pre style=&quot;background: white; font-family: consolas; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;ul&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;containerName&quot;&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;ul&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;style&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #cf4820;&quot;&gt;text-align&lt;/span&gt;: &lt;span style=&quot;color: #4f76ac;&quot;&gt;center&lt;/span&gt;;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;img&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;alt&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;Loading...&quot;&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;../assets/images/svg/three-dots.svg&quot;&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;loading-info&quot;&lt;/span&gt; &lt;span style=&quot;color: #4f76ac;&quot;&gt;/&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;notifyMessage&quot;&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background: white;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: times, &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;Jquery&lt;/span&gt;&lt;/b&gt;&lt;/pre&gt;&lt;pre style=&quot;background: white; font-size: 10pt;&quot;&gt;&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: consolas; font-size: 10pt;&quot;&gt;$&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;document&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt;.ready&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;()&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: consolas; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;  &lt;/span&gt;var&lt;span style=&quot;font-size: 10pt;&quot;&gt; offset &lt;/span&gt;&lt;span style=&quot;color: #1e7c70; font-size: 10pt;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9b5f9b; font-size: 10pt;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #1e7c70; font-size: 10pt;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: consolas; font-size: 10pt;&quot;&gt;  &lt;span style=&quot;color: #4f76ac;&quot;&gt;var&lt;/span&gt; loading &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: consolas; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;  &lt;/span&gt;$&lt;span style=&quot;color: #1e7c70; font-size: 10pt;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125; font-size: 10pt;&quot;&gt;&#39;.loading-info&#39;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70; font-size: 10pt;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;.hide&lt;/span&gt;&lt;span style=&quot;color: #1e7c70; font-size: 10pt;&quot;&gt;();&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: consolas; font-size: 10pt;&quot;&gt;  appendItems&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;offset&lt;span style=&quot;color: #1e7c70;&quot;&gt;,&lt;/span&gt; loading&lt;span style=&quot;color: #1e7c70;&quot;&gt;);&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: consolas; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;  &lt;/span&gt;$&lt;span style=&quot;color: #1e7c70; font-size: 10pt;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;window&lt;/span&gt;&lt;span style=&quot;color: #1e7c70; font-size: 10pt;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;.scroll&lt;/span&gt;&lt;span style=&quot;color: #1e7c70; font-size: 10pt;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #4f76ac; font-size: 10pt;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #1e7c70; font-size: 10pt;&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #1e7c70; font-size: 10pt;&quot;&gt;{&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: consolas; font-size: 10pt;&quot;&gt;        &lt;span style=&quot;color: #4f76ac;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;$&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&#39;#notifyMessage&#39;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt;.html&lt;span style=&quot;color: #1e7c70;&quot;&gt;()&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;===&lt;/span&gt; &lt;span style=&quot;color: #823125;&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #4f76ac;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;$&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;window&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt;.scrollTop&lt;span style=&quot;color: #1e7c70;&quot;&gt;()&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;+&lt;/span&gt; $&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;window&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt;.height&lt;span style=&quot;color: #1e7c70;&quot;&gt;()&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;&amp;gt;=&lt;/span&gt; $&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;document&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt;.height&lt;span style=&quot;color: #1e7c70;&quot;&gt;()&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;-&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt;
                offset &lt;span style=&quot;color: #1e7c70;&quot;&gt;+=&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;20&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
                appendItems&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;offset&lt;span style=&quot;color: #1e7c70;&quot;&gt;,&lt;/span&gt; loading&lt;span style=&quot;color: #1e7c70;&quot;&gt;);&lt;/span&gt;
            &lt;span style=&quot;color: #1e7c70;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: #1e7c70;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: #1e7c70;&quot;&gt;});&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: consolas; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;});&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: consolas; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;function&lt;/span&gt; appendItems&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;offset&lt;span style=&quot;color: #1e7c70;&quot;&gt;,&lt;/span&gt; loading&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #4f76ac;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;loading &lt;span style=&quot;color: #1e7c70;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt;
        loading &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
        $&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&#39;.loading-info&#39;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt;.show&lt;span style=&quot;color: #1e7c70;&quot;&gt;();&lt;/span&gt;
        $.post&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&#39;/admin/items/append&#39;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt; &lt;span style=&quot;color: #823125;&quot;&gt;&#39;offset&#39;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;:&lt;/span&gt; offset &lt;span style=&quot;color: #1e7c70;&quot;&gt;},&lt;/span&gt; &lt;span style=&quot;color: #4f76ac;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;data&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt;
            loading &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: #4f76ac;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;data.trim&lt;span style=&quot;color: #1e7c70;&quot;&gt;()&lt;/span&gt;.length &lt;span style=&quot;color: #1e7c70;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt;
                $&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&#39;.loading-info&#39;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt;.hide&lt;span style=&quot;color: #1e7c70;&quot;&gt;();&lt;/span&gt;
                $&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&#39;#notifyMessage&#39;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt;.html&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&#39;&amp;lt;p&amp;gt; End of records&amp;lt;/p&amp;gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;);&lt;/span&gt;
                &lt;span style=&quot;color: #4f76ac;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: #1e7c70;&quot;&gt;}&lt;/span&gt;
            $&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&#39;.loading-info&#39;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt;.hide&lt;span style=&quot;color: #1e7c70;&quot;&gt;();&lt;/span&gt;
 
            $&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&quot;#containerName&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt;.append&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;data&lt;span style=&quot;color: #1e7c70;&quot;&gt;);&lt;/span&gt;
        &lt;span style=&quot;color: #1e7c70;&quot;&gt;})&lt;/span&gt;.fail&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;xhr&lt;span style=&quot;color: #1e7c70;&quot;&gt;,&lt;/span&gt; ajaxOptions&lt;span style=&quot;color: #1e7c70;&quot;&gt;,&lt;/span&gt; thrownError&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt;
            alert&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;thrownError&lt;span style=&quot;color: #1e7c70;&quot;&gt;);&lt;/span&gt;
        &lt;span style=&quot;color: #1e7c70;&quot;&gt;})&lt;/span&gt;
    &lt;span style=&quot;color: #1e7c70;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: #1e7c70;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-size: 10pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: times, &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;PHP Function&lt;/span&gt;&lt;/b&gt;&lt;/pre&gt;&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: consolas; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;function&lt;/span&gt; append&lt;span style=&quot;color: #1e7c70;&quot;&gt;()&lt;/span&gt;
&lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$list&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #222222;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$offset&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&#39;offset&#39;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;];&lt;/span&gt;
        &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$servername&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #823125;&quot;&gt;&quot;localhost&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$username&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #823125;&quot;&gt;&quot;username&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$password&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #823125;&quot;&gt;&quot;password&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$dbname&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #823125;&quot;&gt;&quot;myDB&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
 
        &lt;span style=&quot;color: #46830d;&quot;&gt;// Create connection&lt;/span&gt;
        &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$conn&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #4f76ac;&quot;&gt;new&lt;/span&gt; mysqli&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #9b5f9b;&quot;&gt;$servername&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$username&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$password&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$dbname&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;);&lt;/span&gt;
        &lt;span style=&quot;color: #46830d;&quot;&gt;// Check connection&lt;/span&gt;
        &lt;span style=&quot;color: #4f76ac;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #9b5f9b;&quot;&gt;$conn&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;-&amp;gt;&lt;/span&gt;connect_error&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #4f76ac;&quot;&gt;die&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&quot;Connection failed: &quot;&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;.&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$conn&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;-&amp;gt;&lt;/span&gt;connect_error&lt;span style=&quot;color: #1e7c70;&quot;&gt;);&lt;/span&gt;
        &lt;span style=&quot;color: #1e7c70;&quot;&gt;}&lt;/span&gt;
 
        &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$sql&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #823125;&quot;&gt;&quot;SELECT id, firstname, lastname FROM employees limit &lt;/span&gt;&lt;span style=&quot;color: #9b5f9b;&quot;&gt;$offset&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;, 20&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$result&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$conn&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;-&amp;gt;&lt;/span&gt;query&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #9b5f9b;&quot;&gt;$sql&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;);&lt;/span&gt;
 
        &lt;span style=&quot;color: #4f76ac;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #9b5f9b;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;-&amp;gt;&lt;/span&gt;num_rows &lt;span style=&quot;color: #1e7c70;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #46830d;&quot;&gt;// output data of each row&lt;/span&gt;
            &lt;span style=&quot;color: #4f76ac;&quot;&gt;while&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #9b5f9b;&quot;&gt;$row&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;-&amp;gt;&lt;/span&gt;fetch_assoc&lt;span style=&quot;color: #1e7c70;&quot;&gt;())&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$list&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;+=&lt;/span&gt;  &lt;span style=&quot;color: #823125;&quot;&gt;&quot;&amp;lt;li&amp;gt;id: &quot;&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;.&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&quot;id&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;].&lt;/span&gt; &lt;span style=&quot;color: #823125;&quot;&gt;&quot; - Name: &quot;&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;.&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&quot;firstname&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;].&lt;/span&gt; &lt;span style=&quot;color: #823125;&quot;&gt;&quot; &quot;&lt;/span&gt; &lt;span style=&quot;color: #1e7c70;&quot;&gt;.&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;&quot;lastname&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;].&lt;/span&gt; &lt;span style=&quot;color: #823125;&quot;&gt;&quot;&amp;lt;/li&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: #1e7c70;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: #1e7c70;&quot;&gt;}&lt;/span&gt; 
        &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$conn&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;-&amp;gt;&lt;/span&gt;close&lt;span style=&quot;color: #1e7c70;&quot;&gt;();&lt;/span&gt;
 
        &lt;span style=&quot;color: #4f76ac;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #9b5f9b;&quot;&gt;$list&lt;/span&gt;&lt;span style=&quot;color: #1e7c70;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #1e7c70;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/pre&gt;
&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://gcsujai.blogspot.com/feeds/5225460429042933012/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2275808999334860244/5225460429042933012' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/5225460429042933012'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/5225460429042933012'/><link rel='alternate' type='text/html' href='http://gcsujai.blogspot.com/2020/05/scroll-loading-using-jquery-and-php.html' title='Scroll Loading using Jquery and PHP'/><author><name>Sujai GC</name><uri>http://www.blogger.com/profile/17693804644569493968</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2275808999334860244.post-7602780362864707750</id><published>2020-04-28T08:54:00.001+05:30</published><updated>2020-05-02T10:47:54.802+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="HTML"/><title type='text'>HTML Scalar Vector Graphics(SVG)</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;b&gt;&lt;u&gt;Left/Right Half Circle Using SVG&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;svg width=&quot;100&quot; height=&quot;100&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;lt;circle cx=&quot;50&quot; cy=&quot;50&quot; r=&quot;50&quot; fill=&quot;grey&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;lt;path d=&quot;M50,0 a1,1 0 100,100 0,0&quot; fill=&quot;orange&quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/svg&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Bottom/Top Half Circle Using SVG&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/b&gt;
&amp;lt;svg width=&quot;100&quot; height=&quot;100&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;lt;circle cx=&quot;50&quot; cy=&quot;50&quot; r=&quot;50&quot; fill=&quot;grey&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;lt;path d=&quot;M0,50 a1,1 0 0,0 100,0&quot; fill=&quot;orange&quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/svg&amp;gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://gcsujai.blogspot.com/feeds/7602780362864707750/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2275808999334860244/7602780362864707750' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/7602780362864707750'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/7602780362864707750'/><link rel='alternate' type='text/html' href='http://gcsujai.blogspot.com/2020/04/html-scalar-vector-graphicssvg.html' title='HTML Scalar Vector Graphics(SVG)'/><author><name>Sujai GC</name><uri>http://www.blogger.com/profile/17693804644569493968</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2275808999334860244.post-1896389377869808313</id><published>2019-08-23T10:31:00.001+05:30</published><updated>2020-05-02T10:49:30.349+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Hosting"/><category scheme="http://www.blogger.com/atom/ns#" term="IIS"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><title type='text'>Host PHP Content on IIS (Internet Information Services)</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;iframe allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;270&quot; src=&quot;https://www.youtube.com/embed/j_0q4DPyxmA&quot; width=&quot;480&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://gcsujai.blogspot.com/feeds/1896389377869808313/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2275808999334860244/1896389377869808313' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/1896389377869808313'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/1896389377869808313'/><link rel='alternate' type='text/html' href='http://gcsujai.blogspot.com/2019/08/host-php-content-on-iis-internet.html' title='Host PHP Content on IIS (Internet Information Services)'/><author><name>Sujai GC</name><uri>http://www.blogger.com/profile/17693804644569493968</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/j_0q4DPyxmA/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2275808999334860244.post-3927843818060531073</id><published>2014-11-06T18:43:00.000+05:30</published><updated>2014-11-06T18:45:45.203+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="CSS"/><category scheme="http://www.blogger.com/atom/ns#" term="HTML"/><title type='text'>How to center a div in the middle of the viewport</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre style=&quot;background: white; font-family: Consolas; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;Note: If you use &amp;lt;form&amp;gt; tag in the page, it should have the same css style as for the html, body&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background: white; font-family: Consolas; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background: white; font-family: Consolas; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;!DOCTYPE&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;html&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;html&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;lang&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;en&quot;&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;head&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;meta&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;viewport&quot;&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;content&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;width=device-width, initial-scale=1&quot;&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;meta&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;charset&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;utf-8&quot;&lt;/span&gt; &lt;span style=&quot;color: #4f76ac;&quot;&gt;/&amp;gt;&lt;/span&gt;
        &lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;title&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;Login&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;title&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;style&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;text/css&quot;&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #823125;&quot;&gt;html&lt;/span&gt;, &lt;span style=&quot;color: #823125;&quot;&gt;body&lt;/span&gt; &lt;span style=&quot;color: #222222;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: #cf4820;&quot;&gt;margin&lt;/span&gt;: &lt;span style=&quot;color: #4f76ac;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;px&lt;/span&gt;;
                &lt;span style=&quot;color: #cf4820;&quot;&gt;padding&lt;/span&gt;: &lt;span style=&quot;color: #4f76ac;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;px&lt;/span&gt;;
                &lt;span style=&quot;color: #cf4820;&quot;&gt;width&lt;/span&gt;: &lt;span style=&quot;color: #4f76ac;&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;%&lt;/span&gt;;
                &lt;span style=&quot;color: #cf4820;&quot;&gt;height&lt;/span&gt;: &lt;span style=&quot;color: #4f76ac;&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;%&lt;/span&gt;;
                &lt;span style=&quot;color: #cf4820;&quot;&gt;display&lt;/span&gt;: &lt;span style=&quot;color: #4f76ac;&quot;&gt;table&lt;/span&gt;;
                &lt;span style=&quot;color: #cf4820;&quot;&gt;font-family&lt;/span&gt;: &lt;span style=&quot;color: #4f76ac;&quot;&gt;Verdana&lt;/span&gt;;
                &lt;span style=&quot;color: #cf4820;&quot;&gt;font-size&lt;/span&gt;: &lt;span style=&quot;color: #4f76ac;&quot;&gt;small&lt;/span&gt;;
            &lt;span style=&quot;color: #222222;&quot;&gt;}&lt;/span&gt;
            &lt;span style=&quot;color: #823125;&quot;&gt;.login-container&lt;/span&gt; &lt;span style=&quot;color: #222222;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: #cf4820;&quot;&gt;display&lt;/span&gt;: &lt;span style=&quot;color: #4f76ac;&quot;&gt;table-cell&lt;/span&gt;;
                &lt;span style=&quot;color: #cf4820;&quot;&gt;text-align&lt;/span&gt;: &lt;span style=&quot;color: #4f76ac;&quot;&gt;center&lt;/span&gt;;
                &lt;span style=&quot;color: #cf4820;&quot;&gt;vertical-align&lt;/span&gt;: &lt;span style=&quot;color: #4f76ac;&quot;&gt;middle&lt;/span&gt;;
            &lt;span style=&quot;color: #222222;&quot;&gt;}&lt;/span&gt;
            &lt;span style=&quot;color: #823125;&quot;&gt;.content&lt;/span&gt; &lt;span style=&quot;color: #222222;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: #cf4820;&quot;&gt;background-color&lt;/span&gt;: &lt;span style=&quot;color: #4f76ac;&quot;&gt;grey&lt;/span&gt;; &lt;span style=&quot;color: #46830d;&quot;&gt;/*&lt;/span&gt; &lt;span style=&quot;color: #46830d;&quot;&gt;sample usage&lt;/span&gt; &lt;span style=&quot;color: #46830d;&quot;&gt;*/&lt;/span&gt;
                &lt;span style=&quot;color: #cf4820;&quot;&gt;display&lt;/span&gt;: &lt;span style=&quot;color: #4f76ac;&quot;&gt;inline-block&lt;/span&gt;;
                &lt;span style=&quot;color: #cf4820;&quot;&gt;text-align&lt;/span&gt;: &lt;span style=&quot;color: #4f76ac;&quot;&gt;left&lt;/span&gt;;
                &lt;span style=&quot;color: #cf4820;&quot;&gt;line-height&lt;/span&gt;: &lt;span style=&quot;color: #4f76ac;&quot;&gt;25&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;px&lt;/span&gt;;
            &lt;span style=&quot;color: #222222;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;style&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;head&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;body&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;section&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;login-container&quot;&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;content&quot;&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;
                &lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;input&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;text&quot;&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;username&quot;&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;userName&quot;&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;maxlength&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;50&quot;&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;placeholder&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;Username&quot;&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;
                &lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;br&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;
                &lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;input&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;password&quot;&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;password&quot;&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;maxlength&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;50&quot;&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;placeholder&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;Password&quot;&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;
                &lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;br&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;
                &lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;
                    &lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;label&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;input&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;checkbox&quot;&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;rememberLogin&quot;&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;rememberLogin&quot;&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;1&quot;&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;Stay logged in&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;label&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;
                    &lt;span style=&quot;color: #cf4820;&quot;&gt;&amp;amp;nbsp;&lt;/span&gt;
                    &lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;input&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;button&quot;&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;login&quot;&lt;/span&gt; &lt;span style=&quot;color: #cf4820;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&quot;Login&quot;&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;
                    &lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;br&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;
                &lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;section&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;body&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #823125;&quot;&gt;html&lt;/span&gt;&lt;span style=&quot;color: #4f76ac;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://gcsujai.blogspot.com/feeds/3927843818060531073/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2275808999334860244/3927843818060531073' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/3927843818060531073'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/3927843818060531073'/><link rel='alternate' type='text/html' href='http://gcsujai.blogspot.com/2014/11/how-to-center-div-in-middle-of-viewport.html' title='How to center a div in the middle of the viewport'/><author><name>Sujai GC</name><uri>http://www.blogger.com/profile/17693804644569493968</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2275808999334860244.post-1373666971298049572</id><published>2012-09-12T13:04:00.001+05:30</published><updated>2012-09-12T13:04:14.980+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET"/><category scheme="http://www.blogger.com/atom/ns#" term="C#.NET"/><title type='text'>Download Files from a specific folder</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
If you want to allow the user to download files from a specific folder in the server the following snippet of code lets you accomplish the task. Initially display all the files the user want to download in a Gridview. Put a download link to let the user download files.&lt;br /&gt;
&lt;br /&gt;
HTML Markup&lt;br /&gt;
&lt;div style=&quot;border: 1px solid black;&quot;&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:GridView ID=&quot;gvFiles&quot; runat=&quot;server&quot; AutoGenerateColumns=&quot;False&quot; CellPadding=&quot;2&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ForeColor=&quot;#333333&quot; GridLines=&quot;None&quot; AllowPaging=&quot;True&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; onpageindexchanging=&quot;gvFiles_PageIndexChanging&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; onrowcommand=&quot;gvFiles_RowCommand&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Columns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:TemplateField&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;ItemTemplate&amp;gt;&lt;br /&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;lt;asp:LinkButton ID=&quot;lbDownload&quot; runat=&quot;server&quot; Text=&quot;Download&quot; CommandName=&quot;Download&quot;&lt;br /&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; CommandArgument=&#39;&amp;lt;%#Eval(&quot;FullName&quot;) &amp;nbsp;%&amp;gt;&#39;&amp;gt;&amp;lt;/asp:LinkButton&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/ItemTemplate&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/asp:TemplateField&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:BoundField DataField=&quot;Name&quot; HeaderText=&quot;File Name&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:BoundField DataField=&quot;Length&quot; HeaderText=&quot;Size (Bytes)&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/Columns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;FooterStyle BackColor=&quot;#5D7B9D&quot; Font-Bold=&quot;True&quot; ForeColor=&quot;White&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;RowStyle BackColor=&quot;#F7F6F3&quot; ForeColor=&quot;#333333&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;PagerStyle BackColor=&quot;#284775&quot; ForeColor=&quot;White&quot; HorizontalAlign=&quot;Center&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;SelectedRowStyle BackColor=&quot;#E2DED6&quot; Font-Bold=&quot;True&quot; ForeColor=&quot;#333333&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;HeaderStyle BackColor=&quot;#5D7B9D&quot; Font-Bold=&quot;True&quot; ForeColor=&quot;White&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;EditRowStyle BackColor=&quot;#999999&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;AlternatingRowStyle BackColor=&quot;White&quot; ForeColor=&quot;#284775&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/asp:GridView&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;br /&gt;
C#&lt;br /&gt;
&lt;div style=&quot;border: 1px solid black;&quot;&gt;
using System.IO;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(!IsPostBack)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; BindDownloadFiles();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; private void BindDownloadFiles()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string DataDirectory= &quot;~/DownloadFiles&quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DirectoryInfo dirInfo = new DirectoryInfo(Server.MapPath(DataDirectory));&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FileInfo[] files = dirInfo.GetFiles();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; gvFiles.DataSource = files;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; gvFiles.DataBind();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; private void DownloadFile(string fileName, string fullFilePath)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Response.AddHeader(&quot;Content-Disposition&quot;, &quot;attachment; filename=&quot; + fileName);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Response.TransmitFile(fullFilePath);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Response.End();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; protected void gvFiles_RowCommand(object sender, GridViewCommandEventArgs e)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (e.CommandName == &quot;Download&quot;)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Uri uri = new Uri(e.CommandArgument.ToString());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string[] fileInfo = uri.LocalPath.Split(&#39;;&#39;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string fullPath = fileInfo[0];&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string fileName = fileInfo[1];&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DownloadFile(fileName, fullPath);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; protected void gvFiles_PageIndexChanging(object sender, GridViewPageEventArgs e)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; gvFiles.PageIndex = e.NewPageIndex;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; BindDownloadFiles();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://gcsujai.blogspot.com/feeds/1373666971298049572/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2275808999334860244/1373666971298049572' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/1373666971298049572'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/1373666971298049572'/><link rel='alternate' type='text/html' href='http://gcsujai.blogspot.com/2012/09/download-files-from-specific-folder.html' title='Download Files from a specific folder'/><author><name>Sujai GC</name><uri>http://www.blogger.com/profile/17693804644569493968</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2275808999334860244.post-4417615074319101405</id><published>2012-08-28T16:02:00.000+05:30</published><updated>2012-08-28T22:52:44.660+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET"/><category scheme="http://www.blogger.com/atom/ns#" term="Jquery"/><title type='text'>Check/Uncheck all checkbox in gridview</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
The following snippet will demostrate how to check/uncheck all checkboxes in a Gridview. Using javascript will take few lines of code to accomplish the task. But using Jquery minimizes the number of lines to code to implement.&lt;br /&gt;
&lt;br /&gt;
Add reference to the jquery library on the page,&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&amp;lt;script src=&quot;http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.8.0.min.js&quot; type=&quot;text/javascript&quot;&amp;gt;&amp;lt;/script&amp;gt;
&lt;/pre&gt;
&lt;pre&gt;&lt;/pre&gt;
&lt;br /&gt;
The script to check/uncheck the gridview checkboxes and the html code would be,&lt;br /&gt;
&lt;div style=&quot;border: 1px solid black;&quot;&gt;
&lt;br /&gt;
&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function ToggleProductSelect(ctrl, chk) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $(&#39;#&amp;lt;%=gvProducts.ClientID %&amp;gt; :checkbox[id$=&#39; + chk + &#39;]&#39;).attr(&#39;checked&#39;, ctrl.checked);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&quot;clear:both;&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:GridView ID=&quot;gvProducts&quot; runat=&quot;server&quot; AutoGenerateColumns=&quot;False&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DataKeyNames=&quot;ProductId&quot; HeaderStyle-CssClass=&quot;header-column&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Columns&amp;gt;&lt;br /&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;lt;asp:TemplateField&amp;gt;&lt;br /&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;lt;HeaderTemplate&amp;gt;&lt;br /&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;lt;input id=&quot;cbSelectAll&quot; runat=&quot;server&quot; type=&quot;checkbox&quot; onclick=&quot;javascript:ToggleProductSelect(this,&#39;cbSelect&#39;);&quot; /&amp;gt;&lt;br /&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;lt;/HeaderTemplate&amp;gt;&lt;br /&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;lt;ItemTemplate&amp;gt;&lt;br /&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;lt;asp:CheckBox ID=&quot;cbSelect&quot; runat=&quot;server&quot; /&amp;gt;&lt;br /&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;lt;/ItemTemplate&amp;gt;&lt;br /&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;lt;/asp:TemplateField&amp;gt;&lt;br /&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;lt;asp:BoundField DataField=&quot;ProductName&quot; HeaderText=&quot;Product Name&quot; /&amp;gt;&lt;br /&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;lt;asp:BoundField DataField=&quot;Category&quot; HeaderText=&quot;Category&quot; /&amp;gt;&lt;br /&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;lt;asp:BoundField DataField=&quot;Price&quot; HeaderText=&quot;Price&quot; /&amp;gt;&lt;br /&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;lt;asp:BoundField DataField=&quot;UnitsInStock&quot; HeaderText=&quot;Units In Stock&quot; /&amp;gt;&lt;br /&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;lt;asp:BoundField DataField=&quot;Supplier&quot; HeaderText=&quot;Supplier&quot; /&amp;gt;&lt;br /&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;lt;asp:CommandField SelectText=&quot;View&quot; ShowSelectButton=&quot;True&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/Columns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;EmptyDataTemplate&amp;gt;&lt;br /&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;lt;div&amp;gt;No Products found.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/EmptyDataTemplate&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;HeaderStyle CssClass=&quot;header-column&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/asp:GridView&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;C#&lt;/b&gt;&lt;br /&gt;
&lt;div style=&quot;border: 1px solid black;&quot;&gt;
&lt;br /&gt;
protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; gvProducts.DataSource = GetProducts();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; gvProducts.DataBind();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public DataTable GetProducts()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DataTable dtProducts = new DataTable();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlDataAdapter adpProducts = new SqlDataAdapter(&quot;GetProducts&quot;, sqlcon);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; adpProducts.SelectCommand.CommandType = CommandType.StoredProcedure;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; try&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; adpProducts.Fill(dtProducts);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return dtProducts;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; catch (Exception)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; throw;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; finally&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sqlcon.Close();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://gcsujai.blogspot.com/feeds/4417615074319101405/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2275808999334860244/4417615074319101405' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/4417615074319101405'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/4417615074319101405'/><link rel='alternate' type='text/html' href='http://gcsujai.blogspot.com/2012/08/checkuncheck-all-checkbox-in-gridview.html' title='Check/Uncheck all checkbox in gridview'/><author><name>Sujai GC</name><uri>http://www.blogger.com/profile/17693804644569493968</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2275808999334860244.post-6901162916416733376</id><published>2012-08-22T15:28:00.000+05:30</published><updated>2012-08-23T14:11:21.264+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="AJAX"/><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET"/><category scheme="http://www.blogger.com/atom/ns#" term="Json"/><title type='text'>Make ajax calls using jquery to bind dropdownlist</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;color: blue; font-size: large;&quot;&gt;Introduction&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
This article describes how to make AJAX calls using Jquery to bind databound control like dropdownlist with data from database. To Bind the data to any databound control, return data as json format.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Default.aspx&lt;/b&gt;&lt;br /&gt;
&lt;div style=&quot;border: 1px solid black;&quot;&gt;
&lt;br /&gt;
&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $(document).ready(function () {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Retrieve data and bind to dropdownlist&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $.ajax({&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; url: &quot;../Services/BookService.asmx/GetBooks&quot;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; contentType: &quot;application/json; charset=utf-8&quot;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dataType: &quot;json&quot;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; type: &quot;POST&quot;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; data: {},&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; error: function (err) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; alert(&quot;Error:&quot; + err.toString());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; },&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; success: function (data) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $(&quot;#booksList&quot;).html(data);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $.each(data.d, function (key, value) {&lt;br /&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; $(&quot;#&amp;lt;%=ddlBooks.ClientID %&amp;gt;&quot;).append($(&quot;&amp;lt;option&amp;gt;&amp;lt;/option&amp;gt;&quot;).val(value.ID).html(value.BookName));&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:DropDownList ID=&quot;ddlBooks&quot; runat=&quot;server&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:ListItem&amp;gt;Choose...&amp;lt;/asp:ListItem&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/asp:DropDownList&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:Button ID=&quot;btnGetBooks&quot; runat=&quot;server&quot; Text=&quot;Get Books&quot; onclick=&quot;
btnGetBooks_Click&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&amp;nbsp;&lt;/div&gt;
&lt;br /&gt;
It is important to register the client script for event validation, since we bind the dropdownlist dynamically using client script it should be registered for event validation. Otherwise, the page will raise an error on postback. Though there is a possibility to bypass this scenario by setting either,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;%@ Page&amp;nbsp;EnableEventValidation=&quot;false&quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or Globally in the Web.config&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pages&amp;nbsp;enableEventValidation=&quot;false&quot;&amp;gt;&amp;lt;/pages&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The setting above may allow hackers to inject sql commands making the application vulnerable. To overcome this problem during the override the Render method as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Default.aspx.cs&lt;/b&gt;&lt;br /&gt;
&lt;div style=&quot;border: 1px solid black;&quot;&gt;
&lt;br /&gt;
protected override void Render(HtmlTextWriter writer)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ClientScript.RegisterForEventValidation(ddlBooks.UniqueID,&quot;1&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ClientScript.RegisterForEventValidation(ddlBooks.UniqueID, &quot;2&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ClientScript.RegisterForEventValidation(ddlBooks.UniqueID, &quot;3&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; base.Render(writer);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;App_Code/Books.cs&lt;/b&gt;&lt;br /&gt;
&lt;div style=&quot;border: 1px solid black;&quot;&gt;
public class Books&lt;br /&gt;
{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public Books()&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public string ID { get; set; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public string BookName { get; set; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public string Author{ get; set; }&lt;br /&gt;
}&lt;/div&gt;
&lt;br /&gt;
Don&#39;t forget to uncomment the line shown below in the .asmx file if it does not exists add one.This enables us to make asynchronous calls to the function.&lt;br /&gt;
&lt;br /&gt;
[System.Web.Script.Services.ScriptService]&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;App_Code/BookService.cs&lt;/b&gt;&lt;br /&gt;
&lt;div style=&quot;border: 1px solid black;&quot;&gt;
using System.Configuration;&lt;br /&gt;
using System.Data;&lt;br /&gt;
using System.Data.SqlClient;&lt;br /&gt;
&lt;br /&gt;
// SQL Server Connection String&lt;br /&gt;
&amp;nbsp; &amp;nbsp; SqlConnection sqlcon = new SqlConnection(ConfigurationManager.ConnectionStrings[&quot;DBConnectionString&quot;].ConnectionString);&lt;br /&gt;
&lt;br /&gt;
[WebMethod]&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public List&amp;lt;Books&amp;gt; GetBooks()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DataTable dtBooks = new DataTable();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; List&amp;lt;Books&amp;gt; books = new List&amp;lt;Books&amp;gt;();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlDataAdapter adpBooks = new SqlDataAdapter(&quot;GetBooks&quot;, sqlcon);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; adpBooks.SelectCommand.CommandType = CommandType.StoredProcedure;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //adpBooks.SelectCommand.Parameters.AddWithValue(&quot;@BookId&quot;, bookId);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; try&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; adpBooks.Fill(dtBooks);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Books book;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; foreach (DataRow dr in dtBooks.Rows)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; book = new Books();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; book.ID = dr[&quot;ID&quot;].ToString();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; book.BookName = dr[&quot;Name&quot;].ToString();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; book.Author = dr[&quot;Author&quot;].ToString();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; books.Add(book);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return books;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; catch (Exception)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; throw;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; finally&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sqlcon.Close();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://gcsujai.blogspot.com/feeds/6901162916416733376/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2275808999334860244/6901162916416733376' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/6901162916416733376'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/6901162916416733376'/><link rel='alternate' type='text/html' href='http://gcsujai.blogspot.com/2012/08/make-ajax-calls-using-jquery-to-bind.html' title='Make ajax calls using jquery to bind dropdownlist'/><author><name>Sujai GC</name><uri>http://www.blogger.com/profile/17693804644569493968</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2275808999334860244.post-1845068281417675458</id><published>2012-08-19T01:54:00.004+05:30</published><updated>2020-06-01T09:03:42.341+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="AJAX"/><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET"/><title type='text'>Call server side functions using PageMethods in AJAX</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h1&gt;Call server side functions using PageMethods in AJAX&lt;/h1&gt;
&lt;p&gt;This post illustrates how to call server side function using PageMethod. Enabling PageMethods property in the ScriptManager allows us to call functions directly from the server side. Therefore significant performance improvement of the page is noticed.&lt;/p&gt;
&lt;br /&gt;
Create a stored procedure to get Books from the database.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CREATE PROCEDURE [dbo].[GetBooks]&lt;br /&gt;
AS&lt;br /&gt;
BEGIN&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;SELECT [ID]&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; ,[BookName]&lt;br /&gt;
&amp;nbsp; FROM [Books]&lt;br /&gt;
END&lt;br /&gt;
GO&lt;br /&gt;
&lt;br /&gt;
We will start by adding ScriptManager on the page and setting the EnablePageMethods property to true.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ajaxToolkit:ToolkitScriptManager ID=&quot;ToolkitScriptManager1&quot; runat=&quot;server&quot; &lt;span style=&quot;color: #cc0000;&quot;&gt;EnablePageMethods=&quot;true&quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;
&amp;lt;/ajaxToolkit:ToolkitScriptManager&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Iterate through the list of books returned by the function using loops and bind the data to controls.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Default.aspx&lt;/b&gt;&lt;br /&gt;
&lt;div style=&quot;border: 1px solid black;&quot;&gt;
&lt;br /&gt;
&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; function getBooks() {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var data = { ID: &quot;1&quot;, Name: &quot;Csharp&quot; };&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PageMethods.getBooks(data, function (returnValue) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (var i in returnValue) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var pList = document.getElementById(&quot;booksList&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var li = document.createElement(&quot;li&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; li.appendChild(document.createTextNode(returnValue[i].ID + &quot; - &quot; + returnValue[i].BookName));&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pList.appendChild(li);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;Using Page Methods to call server side function without web service&amp;lt;/h3&amp;gt;&lt;br /&gt;
&amp;lt;input type=&quot;button&quot; onclick=&quot;getBooks()&quot; value=&quot;Get Books&quot; /&amp;gt;&lt;br /&gt;
&amp;lt;ul id=&quot;booksList&quot;&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;br /&gt;
Add a class in the code behind or in a seperate file and write the function to query the SQL server to get books. Create a WebMethod to which will return list of Books.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Default.aspx.cs
&lt;/b&gt;&lt;br /&gt;
&lt;div style=&quot;border: 1px solid black;&quot;&gt;
using System.Configuration;&lt;br /&gt;
using System.Data;&lt;br /&gt;
using System.Data.SqlClient;&lt;br /&gt;
using System.Web.Services;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
[WebMethod]&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public static List&amp;lt;Books&amp;gt; getBooks(Books b)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DataTable dtBooks = new DataTable();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dtBooks = b.GetBooks();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; List&amp;lt;Books&amp;gt; books = new List&amp;lt;Books&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Books book;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; foreach (DataRow dr in dtBooks.Rows)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; book = new Books();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; book.ID = dr[&quot;ID&quot;].ToString();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; book.BookName = dr[&quot;BookName&quot;].ToString();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; books.Add(book);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return books;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public class Books&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // SQL Server Connection String&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlConnection sqlcon = new SqlConnection(ConfigurationManager.ConnectionStrings[&quot;DBConnectionString&quot;].ConnectionString);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public string ID { get; set; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public string BookName { get; set; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public DataTable GetBooks()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DataTable dtBooks = new DataTable();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlDataAdapter adpBooks = new SqlDataAdapter(&quot;GetBooks&quot;, sqlcon);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; adpBooks.SelectCommand.CommandType = CommandType.StoredProcedure;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //adpBooks.SelectCommand.Parameters.AddWithValue(&quot;@BookId&quot;, bookId);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; try&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; adpBooks.Fill(dtBooks);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return dtBooks;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; catch (Exception)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; throw;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; finally&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sqlcon.Close();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; } &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://gcsujai.blogspot.com/feeds/1845068281417675458/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2275808999334860244/1845068281417675458' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/1845068281417675458'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/1845068281417675458'/><link rel='alternate' type='text/html' href='http://gcsujai.blogspot.com/2012/08/call-server-side-functions-using.html' title='Call server side functions using PageMethods in AJAX'/><author><name>Sujai GC</name><uri>http://www.blogger.com/profile/17693804644569493968</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2275808999334860244.post-6676938472630968554</id><published>2012-08-14T17:00:00.002+05:30</published><updated>2020-06-01T09:05:12.306+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET"/><category scheme="http://www.blogger.com/atom/ns#" term="C#.NET"/><category scheme="http://www.blogger.com/atom/ns#" term="MS Excel"/><title type='text'>Export data from SQL Server to Excel in asp.net</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div&gt;
&lt;h1&gt;Export data from SQL Server to Excel in asp.net&lt;/h1&gt;
&lt;p&gt;This sample introduces how to export data from&amp;nbsp;SQL Server to&amp;nbsp;an&amp;nbsp;Excel spreadsheet and in the next article we shall see how to generate an Excel spreadsheet&amp;nbsp;with data from SQL Server.&lt;/p&gt;
Default page retrieves data from SQL Server using a DataTable and then&amp;nbsp;exports the DataTable to an Excel 2003/2007 spreadsheet on server disk.&lt;br /&gt;&lt;br /&gt;
In the previous post we have seen how to import data from excel to sql server. Please refer the table used in the &lt;a href=&quot;http://gcsujai.blogspot.com/2012/08/import-data-from-excel-to-sql-server.html&quot; target=&quot;_blank&quot;&gt;previous post&lt;/a&gt; for this sample. First, create a procedure to select books from the database. Then create a function in the code-behind page to return Books in a DataTable. Use StringWriter and HtmlTextWriter to iterate through the data in the DataTable. Create an object for DataGrid and Bind the DataTable to it.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;Stored procedure to get Books&lt;/b&gt;&lt;br /&gt;
&lt;div style=&quot;border: 1px solid black;&quot;&gt;
CREATE PROCEDURE [dbo].[GetBooks]&lt;br /&gt;
AS&lt;br /&gt;
BEGIN&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;SELECT [ID]&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; ,[Name]&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; ,[Author]&lt;br /&gt;
&amp;nbsp; FROM [Books]&lt;br /&gt;
END&lt;br /&gt;
GO
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Default.aspx&lt;/b&gt;&lt;br /&gt;
&lt;div style=&quot;border: 1px solid black;&quot;&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
&amp;lt;asp:GridView ID=&quot;gvBooks&quot; runat=&quot;server&quot; AutoGenerateColumns=&quot;False&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; EnableModelValidation=&quot;True&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Columns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:BoundField DataField=&quot;ID&quot; HeaderText=&quot;ID&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:BoundField DataField=&quot;Name&quot; HeaderText=&quot;Book Name&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;asp:BoundField DataField=&quot;Author&quot; HeaderText=&quot;Author&quot; /&amp;gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/Columns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;/asp:GridView&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;asp:Button ID=&quot;btnExport&quot; runat=&quot;server&quot; Text=&quot;Export&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; onclick=&quot;btnExport_Click&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;asp:Label ID=&quot;Label1&quot; runat=&quot;server&quot; Text=&quot;&quot;&amp;gt;&amp;lt;/asp:Label&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Default.aspx.cs&lt;/b&gt;&lt;br /&gt;
&lt;div style=&quot;border: 1px solid black;&quot;&gt;
using System.Configuration;&lt;br /&gt;
using System.Data.SqlClient;&lt;br /&gt;
using System.IO;&lt;br /&gt;
using System.Web;&lt;br /&gt;
using System.Web.UI;&lt;br /&gt;
using System.Web.UI.WebControls;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// SQL Server Connection String&lt;br /&gt;
&amp;nbsp; &amp;nbsp; SqlConnection sqlcon = new SqlConnection(ConfigurationManager.ConnectionStrings[&quot;DBConnectionString&quot;].ConnectionString);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; gvBooks.DataSource = GetBooks();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; gvBooks.DataBind();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
protected void btnExport_Click(object sender, EventArgs e)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ExportToExcel(GetBooks(),&amp;nbsp;&quot;DownloadBooksToExcel.xls&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
public void ExportToExcel(DataTable dt,&amp;nbsp;string fileName)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (dt.Rows.Count &amp;gt; 0)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; StringWriter sw = new StringWriter();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; HtmlTextWriter htmlWriter = new HtmlTextWriter(sw);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DataGrid dg = new DataGrid();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dg.DataSource = dt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dg.DataBind();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dg.RenderControl(
htmlWriter);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Response.ContentType = &quot;application/vnd.ms-excel&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Response.ContentType = &quot;application/vnd.openxmlformats-officedocument.spreadsheetml.sheet&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Response.AppendHeader(&quot;Content-Disposition&quot;, &quot;attachment; filename=&quot; + fileName);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.EnableViewState = false;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Response.Write(sw.ToString());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Response.End();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public DataTable GetBooks()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DataTable dtBooks = new DataTable();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlDataAdapter adpBooks = new SqlDataAdapter(&quot;GetBooks&quot;, sqlcon);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; adpBooks.SelectCommand.CommandType = CommandType.StoredProcedure;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; try&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; adpBooks.Fill(dtBooks);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return dtBooks;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; catch (Exception)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; throw;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; finally&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sqlcon.Close();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://gcsujai.blogspot.com/feeds/6676938472630968554/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2275808999334860244/6676938472630968554' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/6676938472630968554'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2275808999334860244/posts/default/6676938472630968554'/><link rel='alternate' type='text/html' href='http://gcsujai.blogspot.com/2012/08/export-data-from-sql-server-to-excel-in.html' title='Export data from SQL Server to Excel in asp.net'/><author><name>Sujai GC</name><uri>http://www.blogger.com/profile/17693804644569493968</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>