Tutorials on Web Development, Programming, and Web Design

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

How to Delete a file in PHP

In Tutorials

In the last tutorial, we wrote to a log file called “log.txt” in PHP.  Now we use PHP to delete this file.  Simple do… unlink(‘log.txt’); in PHP.  And the file will...

read more

Tutorial on How to Write to a File in PHP

In Tutorials

In this tutorial, we will show you how to write to a log file in PHP.  Here is a basic function we called “writelog” which takes a $msg message string to be written into a log file...

read more

Tutorial using PHP to Query MySQL

In Tutorials

In this tutorial, we will use PHP to query a MySQL database.  For the purpose of this example, suppose we want to query the last 5 posts from a WordPress MySQL database.  We will need to know the...

read more

File Upload in PHP Tutorial

In Tutorials

In this tutorial, we will build a file upload form in PHP to upload an image file to the web server.   In the process, we will perform a few security checks to prevent file upload abuse. 1.  Start...

read more

Using Random Form Token to Help Protect Against CSRF

In Tutorials

Suppose we have the following form in index.php … that will POST to do.php to do something.  To help protect against CSRF (cross-site request forgery), in do.php we have to make sure that it...

read more

How to Create a Right-Click Menu using JQuery

In Tutorials

In this tutorial, we will create a right-click menu (better known as a context menu) that will come up when you right-click on the page … For Mac, you would do Ctrl-Click, since Mac mouse have...

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.