Creating a Database The CREATE DATABASE statement in sql is used to create a database in MySQL. In PHP,mysql_query() function is used to execute sql query like insert, delete, update, select etc. Here is an example PHP script that creates a…
Tag: PHP
PHP-MySQL Lesson – Connecting to MySQL database
Connecting to MySQL database In order to access and manage records in a database, we need first to establish a connection to the database. To connect to the MySQL database we are going to use the mysql_connect() function. Here is…
PHP Tutorial – PHP Forms
In this tutorial we are going to learn how to take data entered by the user in an HTML form and process it into PHP script and display the output. We need two pages here namely the process.php and the…
How to create a Blog Post in Drupal
Creating blog post In this lesson we are going to learn how to enable and start creating blog post in Drupal. How to enable the blog module: 1. Login to your Drupal site using the administrator account. 2. Click Modules…
PHP Tutorial – PHP $_GET and $_POST
PHP $_GET and $_POST The PHP $_GET and $_POST variables are used to retrieve information from forms, like user input. The $_POST Function The built-in $_POST function is used to collect values in a form with method=”post”. Information sent from…
PHP Tutorial – PHP Function
PHP Tutorial – PHP Function In this lesson we are going to learn how to create a function in PHP. A function is a block of codes that performs a particular task which can be executed anywhere in the page…
PHP Tutorial – PHP Arrays
PHP Tutorial – PHP Arrays An array is a special variable that can store multiple values in a single variable. The elements of the array are accessed via an index number, with the first element starting at zero. An array…
PHP Tutorial – for loop
The for loop The for loop is used to execute a set of statements for a certain number of times. Syntax: for (init; condition; increment/decrement) { code to be executed; } Components of for loop: init: set a counter variable…
PHP Tutorial – do while loop
The do while loop In do while loop the statements or conditions are executed first then that condition is evaluated, the loop will continue while the condition is true. Syntax: do { code to be executed; } while (condition); Example:…
PHP Tutorial – The while loop
A loop is a block of code that enables you to repeat the same set of statements or commands over and over again; the actual number of repetitions may be dependent on a number you specify. The while loop The…