Tutorials on Web Development, Programming, and Web Design

Difference between htmlentities and htmlspecialchars in PHP

In Articles

What is the difference in htmlentities() and htmlspecialchars() function in PHP? htmlspecialchars() is a subset of htmlentities(). While htmlentities converts “all applicable characters to HTML...

read more

PHP Proper Logout Code

In Tutorials

To provide a logout function, we have to destroy the session and expire the cookie (if cookies are being used to pass along the session identifier).  Based on the PHP manual, you have something like...

read more

Things to Check to Make Sure PHP Code is Secure

In Articles

Here are some things to check to make sure PHP code is secure. Check to make sure you are validating or filtering inputs. Search $_GET, $_POST, $_REQUEST. Use filter_var(), strip_tags(),...

read more

PHP is insecure by default

In Articles

When I say PHP is insecure by default is that if you just write PHP code to do something (just like they teach in the basic tutorials or in first year programming classes), then most likely the code...

read more

Example of Using PhpMailer to send emails in PHP

In Tutorials

PHP has a default mail() function for sending out emails.  However, the open source PHPMailer Library is much more easier to use.  You don’t have to construct the mail headers yourself, and...

read more

Trying to setup PHP development environment with Vagrant

In Tutorials

We want to set up a PHP development environment.  In the past, we would install the LAMP stack (Linux Apache MySQL and PHP) directly on our machine or use a package like XAMPP, MAMP, or WAMP.  But...

read more

Using Prepared Statement with PHP and MySQL

In Tutorials

In the previous tutorial, we used mysqli API that comes with PHP to query a MySQL database.  In this tutorial, instead of sending a SQL query statement, we are going to use prepared statement to...

read more

Updating MySQL with PHP using mysqli

In Tutorials

This tutorial continues directly from the last tutorial where we inserted an record.  Now we will update the record that was just inserted.  Adding to the previous code, we construct an MySQL...

read more

Using mysqli to insert to MySQL database

In Tutorials

In previous tutorial, we will saw how to query from MySQL database, now we use mysqli to insert to the “example” table of the a MySQL database. Like before, we call mysqli_connect with...

read more

Learn Web Tutorials is hosted by Hostmonster and design based on Wordpress template by Elegant Themes
All contents are opinions and are copyrighted and may contain display ads and ad links for which site may receive revenues from.
See Terms of Use and Privacy Policy.