Learn PHP Procedural From Scratch in Urdu Hindi
5.0 (1 rating)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
3 students enrolled
Wishlisted Wishlist

Please confirm that you want to add Learn PHP Procedural From Scratch in Urdu Hindi to your Wishlist.

Add to Wishlist

Learn PHP Procedural From Scratch in Urdu Hindi

PHP Training
5.0 (1 rating)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
3 students enrolled
Created by Assad Ullah Ch
Last updated 11/2016
Urdu
Current price: $12 Original price: $40 Discount: 70% off
3 days left at this price!
30-Day Money-Back Guarantee
Includes:
  • 19 hours on-demand video
  • 9 Supplemental Resources
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion

Training 5 or more people?

Get your team access to Udemy's top 2,000 courses anytime, anywhere.

Try Udemy for Business
What Will I Learn?
  • Command on PHP fundamentals
  • Skills to write the code on your own
View Curriculum
Requirements
  • Basic knowledge of HTML
  • Your favorite web browser e.g. Google Chrome, Mozilla Firefox, Safari or any
  • Your favorite text editor e.g. Notepad++, Sublime, Atom, Brackets or any
  • Download and Install localhost server e.g. XAMPP, WAMP or MAMP Stack
Description

This detailed course is designed for those students who want to start their career as a PHP web developer. The aim of this course is to take you from scratch to strong understanding of PHP fundamentals. After completing this course, students will be ready for the next level of PHP which is Object Oriented Programming.

What is PHP?

PHP  is a recursive acronym which stands for Hypertext Preprocessor. Originally PHP stood for Personal Home Page. It is open source (freely available) which was originally created in 1994 by Resmus Lerdorf. It is a general purpose programming language but widely used in web development. 

What is PHP Procedural?

PHP procedural or PHP fundamentals (two names of the same thing) is extremely important for one who want to start his/her career as a PHP back end developer. If you have command on PHP procedural, you will be able to learn rest of the stuff very easily. Whether you are writing a WordPress plugin or making an MVC application, the fundamentals go hand in hand. If you are not good at fundamentals, that means, you are not a good developer. 

Market value?

PHP has a high demand in web development. There are famous Content Management Systems written in PHP for example WordPress, Joomla, Drupal, Open Cart, Zen Cart, Magento and many more. Famous Model View Controller frameworks are CodeIgniter, Laravel, Sympfony, CakePHP, Yii and Zend.      

Who is the target audience?
  • No prior experience is required
  • This course is meant for absolute beginners
  • Those who want to learn Web Development in PHP
  • Those who want to improve their basic foundation
Compare to Other Web Development Courses
Curriculum For This Course
138 Lectures
18:58:27
+
The Basics
11 Lectures 01:18:34

PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML.

Instead of lots of commands to output HTML (as seen in C or Perl), PHP pages contain HTML with embedded code that does "something" (in this case, output "Hi, I'm a PHP script!"). The PHP code is enclosed in special start and end processing instructions <?php and ?> that allow you to jump into and out of "PHP mode."

What distinguishes PHP from something like client-side JavaScript is that the code is executed on the server, generating HTML which is then sent to the client. The client would receive the results of running that script, but would not know what the underlying code was. You can even configure your web server to process all your HTML files with PHP, and then there's really no way that users can tell what you have up your sleeve.

The best things in using PHP are that it is extremely simple for a newcomer, but offers many advanced features for a professional programmer. Don't be afraid reading the long list of PHP's features. You can jump in, in a short time, and start writing simple scripts in a few hours.


Preview 04:11

What is XAMPP?

XAMPP stands for Cross-Platform (X), Apache (A), MariaDB (M), PHP (P) and Perl (P). It is a simple, lightweight Apache distribution that makes it extremely easy for developers to create a local web server for testing and deployment purposes. Everything needed to set up a web server – server application (Apache), database (MariaDB), and scripting language (PHP) – is included in an extractable file. XAMPP is also cross-platform, which means it works equally well on Linux, Mac and Windows. Since most actual web server deployments use the same components as XAMPP, it makes transitioning from a local test server to a live server extremely easy as well.

What is Sublime Text?

Sublime Text is a sophisticated text editor for code, markup and prose. You'll love the slick user interface, extraordinary features and amazing performance. The window text editor can also be used for writing code but the text editors which are specifically created for code writing makes them special because they come up with lots of builtin features which help out a programmer and speed up his work. For example text indentation, code suggestions, different color schemes for different types of code. 

Preview 11:54

The PHP code is enclosed in special start and end processing instructions <?php and ?> that allow you to jump into and out of "PHP mode." Everything outside of a pair of opening and closing tags is ignored by the PHP parser which allows PHP files to have mixed content. This allows PHP to be embedded in HTML documents, for example to create templates.

Writing The First Program
09:31

A comment in PHP code is a line that is not read/executed as part of the program. Its only purpose is to be read by someone who is looking at the code.

Comments can be used to:

  • Let others understand what you are doing
  • Remind yourself of what you did - Most programmers have experienced coming back to their own work a year or two later and having to re-figure out what they did. Comments can remind you of what you were thinking when you wrote the code
What Are The Comments
03:57

A variable works like a bucket or you can also call it a storage which can hold only one value at max. 

For example:

/*declaring and initializing a variable with a value*/
$var = 25;

/*assigning some other value*/
$var = "I love programming";

Now the variable $var contains "I love programming", not 25 since the variable was overwritten with the new value. The old value has been gone or lost. 

A variable can have a short name (like x and y) or a more descriptive name (age, carname, total_volume).

Rules for PHP variables:

  • A variable starts with the $ sign, followed by the name of the variable
  • A variable name must start with a letter or the underscore character
  • A variable name cannot start with a number
  • A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )
  • Variable names are case-sensitive ($age and $AGE are two different variables)


Variables
11:35

A constant is an identifier (name) for a simple value. The value cannot be changed during the script.

A valid constant name starts with a letter or underscore (no $ sign before the constant name).

Note: Unlike variables, constants are automatically global across the entire script.


Constants
06:20

Variables can store data of different types, and different data types can do different things.

PHP supports the following data types:

  • String
  • Integer
  • Float (floating point numbers - also called double)
  • Boolean
  • Array
  • Object
  • NULL
  • Resource
Data Types
12:59

Embedding PHP into HTML allows you to show dynamic content generated by PHP within HTML. 

In the following example there are two HTML paragraphs and PHP script is embedded between them.

<p>This is going to be ignored by PHP and displayed by the browser.</p>
<?php echo 'While this is going to be parsed.'; ?>
<p>This will also be ignored by PHP and displayed by the browser.</p>


Embedding PHP into HTML
02:17

Embedding HTML into PHP
05:15

The echo statement is used to output a string or numeric values. Unlike print you can pass it multiple values separated using commas and it outputs a concatenated string. Do not use parenthesis if you want to pass more than one values. It does not return anything.

 The print statement is used to output a string or numeric values. Unlike echo you cannot pass multiple values to it. Print always returns 1.

Print vs Echo Statement
04:29
+
Arrays
7 Lectures 01:12:50

An array is a data structure which allows you to store more than one values in a variable unlike an ordinary variable which can only hold one value at a time. An indexed array is the one which has index numbers. Each value is assigned a specific index number. 

The following array contains two values "bar" and "foo" and each value is placed at a specific index number. The "bar" is automatically assigned index number 0 (zero) whereas "foo" is assigned index number 1 (one). Every next value will automatically be assigned a next available index number.

$array = array( "bar", "foo", );

In order to output "bar" you have to type

echo $array[0]





Indexed or Numeric Array
15:35

Associative arrays are arrays that use named keys that you assign to them instead of index numbers.

There are two ways to create an associative array: 

$age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43");

or:

$age['Peter'] = "35";
$age['Ben'] = "37";
$age['Joe'] = "43";

Associative Array
09:23

A multidimensional array is an array containing one or more arrays.

PHP understands multidimensional arrays that are two, three, four, five, or more levels deep. However, arrays more than three levels deep are hard to manage for most people.

This is how you can create a two dimensional array also called 2d array.

$cars = array
  (
  array("Volvo",22,18),
  array("BMW",15,13),
  array("Saab",5,2),
  array("Land Rover",17,15)
  );

In order to access "Volvo" you have to access the first internal array which is at index 0 (zero).

First zero in the square brackets to access the 0th index of outer array and the following square brackets with zero to access the first internal array value which is "Volo".

echo $cars[0][0];

Multi Dimensional Indexed Array
10:27

A multidimensional associative array is an array containing one or more associative arrays.

This is how you can create a multidimensional associative array.

$fruits = array (
    "fruits"  => array("a" => "orange", "b" => "banana", "c" => "apple"),
    "holes"   => array("first"=>"one", "second" => "two", "third"=>"three")
);

Now in order to access "orange" first we need to check which index name is assigned to internal array which contains the value "orange". You can see "fruits" is the index name which is assigned to first internal array and to access the value "orange" you need to specify it's index name as well which is "a". 

This is how you can output "orange"

echo $fruits["fruits"]["a"];

Multi Dimensional Associative Array
06:30

An array which has the characteristics of an indexed array and associative array. In other words hybrid array is the one which is both indexed and associative. 

For example:

$array = array("fname"=>"Assad", 1000, 25, "city"=>"Lahore");

The multidimensional hybrid array looks like the following. 

$fruits = array (
    "fruits"  => array("a" => "orange", "b" => "banana", "c" => "apple"),
    "numbers" => array(1, 2, 3, 4, 5, 6),
    "holes"   => array("first", 5 => "second", "third")
);

If you take a careful look, the above array contains some values which are assigned index numbers whereas the other values are assigned index names.
Single & Multi Dimensional Hybrid Array
08:05

Practice Arrays Section Part 1
10:36

Practice Arrays Section Part 2
12:14
+
Operators
9 Lectures 01:47:10

Arithmetic operators allow you to perform arithmetic operation in a programming language. These are the same operators which you learned in your school. 

  • Addition operator +
  • Subtraction operator -
  • Division operator /
  • Multiplication operator *
  • Modulus %
  • Exponentiation ** ( introduced in PHP 5.6 )

 

Arithmetic Operators
12:48

The precedence of an operator specifies how "tightly" it binds two expressions together. For example, in the expression 1 + 5 * 3, the answer is 16 and not 18because the multiplication ("*") operator has a higher precedence than the addition ("+") operator. Parentheses may be used to force precedence, if necessary. For instance: (1 + 5) * 3 evaluates to 18.

Preview 17:27

The PHP array operators are used to compare arrays. There's a union operator which allows you to combine two arrays into one. The union operator works like the same as the mathematical concept of union. 

Array Operators
10:39

The PHP increment operators are used to increment a variable's value whereas the PHP decrement operators are used to decrement a variable's value.

$var = 20;
$var++; //increments the value and assigned it back to $var which is now 21

$var = 20;
$var--; //decrements the value and assigned it back to $var which is now 19


Increment & Decrement Operators
03:45

The basic assignment operator in PHP is "=". It means that the left operand gets set to the value of the assignment expression on the right. Rest of the other assignment operators are used for numeric values.

Assignment Operators
05:32

Comparison operators are used to compare two values. 

Comparison Operators
15:32

The PHP logical operators are used to combine conditional statements.

Logical Operators
19:05

Logical Operators Precedence
11:35

String operator allow you to combine or concatenate two stings into one. 

String Operators
10:47
+
Control Structures
15 Lectures 02:02:49

Conditional statements are used to perform different actions based on different conditions. 

if statement - executes some code if one condition is true.

if (condition) {
    code to be executed if condition is true
;
}

If Statement
08:29

Often you'd want to execute a statement if a certain condition is met, and a different statement if the condition is not met. This is what else is for.

if (condition) {
    code to be executed if condition is true;
} else {
    code to be executed if condition is false;
}

If...Else Statements
05:47

The if....elseif...else statement executes different codes for more than two conditions.

if (condition) {
    code to be executed if this condition is true;
} elseif (condition) {
    code to be executed if this condition is true;
} else {
    code to be executed if all conditions are false;
}

If...Elseif...Else Statements
08:09

The nested if.. else statements contains one or more if else statements in their bodies. 

if (some condition){    
   if (another condition){
      if (yet another condition){
         things to do if some condition, another condition, and yet another condition are met
      }
      else{
         things to do if if some condition and another condition are met and yet another condition is not met 
      }
   }    
   else{
      list of things to do if some condition is met but if another condition is not met
   } 
}
else{
   list of things to do if some condition is not met
}


Nested If...Elseif...Else Statements
12:22

The switch statement is similar to a series of IF statements on the same expression. In many occasions, you may want to compare the same variable (or expression) with many different values, and execute a different piece of code depending on which value it equals to. This is exactly what the switch statement is for.

Switch Statement
10:54

PHP for loops execute a block of code a specified number of times.

for (init counter; test counter; increment counter) {
    code to be executed;
}

Parameters:

  • init counter: Initialize the loop counter value
  • test counter: Evaluated for each loop iteration. If it evaluates to TRUE, the loop continues. If it evaluates to FALSE, the loop ends.
  • increment counter: Increases the loop counter value


For Loop
08:06

The while loop executes a block of code as long as the specified condition is true

while (condition is true) {
    code to be executed;
}

While Loop
04:51

The do...while loop will always execute the block of code once, it will then check the condition, and repeat the loop while the specified condition is true.

do {
    code to be executed;
} while (condition is true);

Do While Loop
03:42

One for loop containing one or more for loops is called a nested for loop. The for loop can also contain other loops types of loops as well.

for ( initialization; condition; increment/decrements ){

   for ( initialization; condition; increment/decrements ){
      statement(s);
   }
   statement(s);
}


Nested For Loop
10:29

One while loop containing one or more while loops is called a nested while loop. The while loop can also contain other loops types of loops as well.

while(condition){

    while(condition){
        statement(s);
        increment/decrements;
    }
    statement(s);
    increment/decrements;
}

Nested While Loop
08:10

Do while loop containing one or more do while loops is called a nested do while loop. The do while loop can also contain the other types of loops.

do{
   statement(s);
   increment/decrements;
   do{
      statement(s);
      increment/decrements;
   }while( condition );
}while( condition );

Nested Do While Loop
06:29

The foreach construct provides an easy way to iterate over arrays. foreach works only on arrays and objects, and will issue an error when you try to use it on a variable with a different data type or an uninitialized variable. 

The following syntax of the foreach loop is used to get only array values.

foreach ($array as $value) {
    code to be executed;
}

Unlike above syntax, the following foreach loop is used if you want to get the values and and corresponding array index names or index numbers as well.

foreach ($array as $key=> $value) {
    code to be executed;
}

Foreach Loop
10:09

Practice Control Structures Section Part 1
05:38

Practice Control Structures Section Part 2
12:48

Practice Control Structures Section Part 3
06:46
+
Superglobal Variables
9 Lectures 01:43:40

PHP $_GET can also be used to collect form data after submitting an HTML form with method="get". It can also collect data sent in the URL.

$_GET Array
16:26

PHP $_POST is widely used to collect form data after submitting an HTML form with method="post". $_POST is also widely used to pass variables.

$_POST Array
06:52

$_SERVER is a PHP super global variable which holds information about headers, paths, and script locations.

The example below shows how to use some of the elements in $_SERVER:

<?php 
echo $_SERVER['PHP_SELF'];
echo "<br>";
echo $_SERVER['SERVER_NAME'];
echo "<br>";
echo $_SERVER['HTTP_HOST'];
echo "<br>";
echo $_SERVER['HTTP_REFERER'];
echo "<br>";
echo $_SERVER['HTTP_USER_AGENT'];
echo "<br>";
echo $_SERVER['SCRIPT_NAME'];
?>

$_SERVER Array
05:24

An associative array of items uploaded to the current script via the HTTP POST method. The structure of this array is outlined in the POST method uploads section.

$_FILES Array
12:18

Real Life Scenario to Understand Session
13:16

Sessions are stored stored on server. The sessions are stored stored inside a directory named "tmp". If you want to check the stored session file in your XAMPP server, you will have to open up xampp directory and then tmp directory which contains all the session files. 

Viewing Session Location & Session File
03:50

A session is a way to store information (in variables) to be used across multiple pages. Unlike a cookie, the information is not stored on the users computer.

$_SESSION Array
19:54

Whenever you create a session, a cookie is also created containing the session id which then embeds in the user's browser.

Viewing Cookie Location & Cookie Creation Upon Session Set
08:08

A cookie is often used to identify or track a user. A cookie is a small file that the server embeds on the user's computer. Each time the same computer requests a page with a browser, it will send the cookie too. With PHP, you can both create and retrieve cookie values.

$_COOKIE Array
17:32
+
User Defined Functions
11 Lectures 01:43:31
Function Type 1
05:14

Function Type 2
04:07

Function Type 3
04:35

Function Type 4
04:20

Anonymous functions, also known as closures, allow the creation of functions which have no specified name. 

Anonymous Functions
06:41

A recursive function is a function that calls itself in it's body. There are two types of recursions. 

  1. Direct recursion
  2. Indirect recursion


In direct recursion a function calls itself in it's body. 

function do_something(){
    if(some base condition where recursion stops){
            some code here....
     }
    do_something(); recursive call

}

In indirect recursion, a function calls to second function and the second functions calls back to first function.

function first(){     
    second(); indirect recursive call
}

function second(){     
    if(some base condition where recursion stops){             
       some code here....      
    }     
    first(); indirect recursive call
}

You have to be very careful about choosing the base case of your recursive program. It's not a good idea to choose recursion to code all of your problems. It only comes into play when an iterative solution of some algorithm gets too messy to understand.

Recursion
14:51

A variable declared outside a function has a GLOBAL SCOPE and can only be accessed outside a function. Similarly a variable declared inside a function can only be accessed inside the function body. One can use $GLOBALS or global to access a variable declared outside the function but it is not suggested. The reason is there are chances a globally available variable can get modified which could result in inconsistent results. 

<?php
$x = 5; // global scope

function myTest() {
    // using x inside this function will generate an error
    echo "<p>Variable x inside function is: $x</p>";

myTest();

echo "<p>Variable x outside function is: $x</p>";
?>

Types of Scope
10:02

Practice User Defined Function Part 1
15:39

Practice User Defined Function Part 2
05:39

Practice User Defined Function Part 3
15:21

Practice User Defined Function Part 4
17:02
+
File Handling
13 Lectures 01:56:26

File handling is an important part of any web application. You often need to open and process a file for different tasks.

Be careful when manipulating files!

When you are manipulating files you must be very careful.

You can do a lot of damage if you do something wrong. Common errors are: editing the wrong file, filling a hard-drive with garbage data, and deleting the content of a file by accident.

Introduction
07:48

File modes are very important and you have to choose one depending upon your requirement. For example if you want to write something on your file without appending the previous written text, you will use the mode: "w". Similarly there are lots of other modes as well with different functionalities.

What are the Modes?
05:33

The fopen() function is also used to create a file. Maybe a little confusing, but in PHP, a file is created using the same function used to open files.

If you use fopen() on a file that does not exist, it will create it, given that the file is opened for writing (w) or appending (a).

Creating a File
07:39

The fwrite() function is used to write to a file. The first parameter of fwrite() contains the name of the file to write to and the second parameter is the string to be written.

Writing a File
06:20

The fread() function reads from an open file.The first parameter of fread() contains the name of the file to read from and the second parameter specifies the maximum number of bytes to read.

Reading a File
06:13

The file_get_contents() reads a file into a string.This function is the preferred way to read the contents of a file into a string. Because it will use memory mapping techniques, if this is supported by the server, to enhance performance.

Reading a File Using file_get_contents()
03:22

The file_put_contents() writes a string to a file

This function follows these rules when accessing a file:

  1. If FILE_USE_INCLUDE_PATH is set, check the include path for a copy of *filename*
  2. Create the file if it does not exist
  3. Open the file
  4. Lock the file if LOCK_EX is set
  5. If FILE_APPEND is set, move to the end of the file. Otherwise, clear the file content
  6. Write the data into the file
  7. Close the file and release any locks


This function returns the number of character written into the file on success, or FALSE on failure.

Writing a File Using file_put_contents()
04:46

The unlink() function deletes a file. This function returns TRUE on success, or FALSE on failure.

Deleting a File
05:29

It is possible to insert the content of one PHP file into another PHP file (before the server executes it), with the include or require statement.

The include and require statements are identical, except upon failure:

  • require will produce a fatal error (E_COMPILE_ERROR) and stop the script
  • include will only produce a warning (E_WARNING) and the script will continue

So, if you want the execution to go on and show users the output, even if the include file is missing, use the include statement. Otherwise, in case of FrameWork, CMS, or a complex PHP application coding, always use the require statement to include a key file to the flow of execution. This will help avoid compromising your application's security and integrity, just in-case one key file is accidentally missing.

Including files saves a lot of work. This means that you can create a standard header, footer, or menu file for all your web pages. Then, when the header needs to be updated, you can only update the header include file.

Including a File Using Include vs Require Statement
14:40


Practice File Handling Section Building Front End
18:10

Practice File Handling Section Building Back End Part 1
18:00

Practice File Handling Section Building Back End Part 2
08:28
+
Filters & Security
5 Lectures 52:41

It is very important to properly sanitize and validate foreign inputs. The input could be a user input or there might be some other application which sends some data to your website and that will also be treated as a foreign inputs. For security reasons, foreign inputs are always sanitized and validated properly. 

Introduction
09:07

The filter_has_var checks if variable of specified type exists. 

Description:

bool filter_has_var ( int $type , string $variable_name )

Detail about parameters:

type

One of INPUT_GETINPUT_POSTINPUT_COOKIEINPUT_SERVER, or INPUT_ENV.

variable_name

Name of a variable to check.


Checking a Variable Existence in Superglobal Variables
13:30

The filter_input is used to optionally filter the foreign input variables. 

Description:

mixed filter_input ( int $type , string $variable_name [, int $filter = FILTER_DEFAULT [, mixed $options ]] )

Detail:

type

One of INPUT_GETINPUT_POSTINPUT_COOKIEINPUT_SERVER, or INPUT_ENV.

variable_name

Name of a variable to get.

filter

The ID of the filter to apply. The Types of filters manual page lists the available filters.

If omitted, FILTER_DEFAULT will be used, which is equivalent toFILTER_UNSAFE_RAW. This will result in no filtering taking place by default.

options

Associative array of options or bitwise disjunction of flags. If filter accepts options, flags can be provided in "flags" field of array.

Visit this link for further reading http://php.net/manual/en/function.filter-input.php

Checking Foreign Variables & Optionally Filter Them
09:04

The filter_var function filters the variable with a specified filter. 

Description:

mixed filter_var ( mixed $variable [, int $filter = FILTER_DEFAULT [, mixed $options ]] )

Detail:

variable

Value to filter. Note that scalar values are converted to string internally before they are filtered.

filter

The ID of the filter to apply. The Types of filters manual page lists the available filters.

If omitted, FILTER_DEFAULT will be used, which is equivalent toFILTER_UNSAFE_RAW. This will result in no filtering taking place by default.

options###pcallable type should be passed. The callback must accept one argument, the value to be filtered, and return the value after filtering/sanitizing it.

Click for further reading http://php.net/manual/en/function.filter-var.php

Filtering a Variable With Specified Filter
10:57

Sanitization will sanitize the data, so it may alter it by removing undesired characters. For example, passing in FILTER_SANITIZE_EMAIL will remove characters that are inappropriate for an email address to contain. That said, it does not validate the data.

Sanitizing the Variable
10:03
+
MySQL Database and Mysqli Extension
19 Lectures 02:41:29
Often abbreviated DB. A collection of information organized in such a way that a computer program can quickly select desired pieces of data. You can think of a database as an electronic filing system. 
Traditional databases are organized by fields, records, and files. A field is a single piece of information; a record is one complete set of fields; and a file is a collection of records. For example, a telephone book is analogous to a file. It contains a list of records, each of which consists of three fields: name, address, and telephone number. 

An alternative concept in database design is known as Hypertext. In a Hypertext database, any object, whether it be a piece of text, a picture, or a film, can be linked to any other object. Hypertext databases are particularly useful for organizing large amounts of disparate information, but they are not designed for numerical analysis. 

To access information from a database, you need a database management system (DBMS). This is a collection of programs that enables you to enter, organize, and select data in a database. 

Database management system: 

A collection of programs that enables you to store, modify, and extract information from a database. There are many different types of DBMSs, ranging from small systems that run on personal computers to huge systems that run on mainframes. The following are examples of database applications: 

  • computerized library systems 
  • automated teller machines 
  • flight reservation systems 
  • computerized parts inventory systems 

From a technical standpoint, DBMSs can differ widely. The terms relational, network, flat, and hierarchical all refer to the way a DBMS organizes information internally. The internal organization can affect how quickly and flexibly you can extract information. 

Requests for information from a database are made in the form of a query, which is a stylized question. For example, the query 

SELECT ALL WHERE NAME = "SMITH" AND AGE > 35 

requests all records in which the NAME field is SMITH and the AGE field is greater than 35. The set of rules for constructing queries is known as a query language. Different DBMSs support different query languages, although there is a semi-standardized query language called SQL (structured query language). Sophisticated languages for managing database systems are called fourth-generation languages, or 4GLs for short. 

The information from a database can be presented in a variety of formats. Most DBMSs include a report writer program that enables you to output data in the form of a report. Many DBMSs also include a graphics component that enables you to output information in the form of graphs and charts.
What is Database & Why Do We Use It?
10:42

MySQL, the most popular Open Source SQL database management system, is developed, distributed, and supported by Oracle Corporation.

What is SQL?

SQL stands for Structured Query Language which is used to communicate with database. SQL is the standardized language used to access the database.

What is MySQLi?

The original MySQL extension is now deprecated, and will generate E_DEPRECATEDerrors when connecting to a database. Instead, use the MySQLi or PDO_MySQLextensions.

Check the deprecated features in PHP5.5.x here http://php.net/manual/en/migration55.deprecated.php

Introduction to MySQL
10:11

Take the following steps to create your database using phpmyadmin.

  1. Open up XAMPP control and start mysql module.
  2. Open up browser and type localhost/phpmyadmin or just type localhost and select phpmyadmin from the menu.
  3. Click databases tab.
  4. Input database name and click create.


Your database has been created.!!

Creating a Database
08:43

Database Users & Settings
16:14

Take the following steps to create a table in your database. 

  1. Open up XAMPP control and start mysql module.
  2. Open up browser and type localhost/phpmyadmin or just type localhost and select phpmyadmin from the menu.
  3. Click databases and choose your database from the table or from the left menu right underneath phpmyadmin logo.
  4. In create table section, type the table name of your choice. 
  5. In the next box, choose the number of columns you want in your table to store information.
  6. Click go
  7. Type table field name in each row and selected desired datatype
  8. Make your first table field a primary key and select A_I (Auto Increment)
  9. Type field names in the rest of the columns and choose datatypes accordingly.
  10. Click go and table should be created after pressing the go button.


Watch the video lesson very carefully. All of these steps are explained there.


Creating a Table
07:30

The INSERT INTO statement is used to insert new records in a table. It is possible to write the INSERT INTO statement in two forms.

The first form does not specify the column names where the data will be inserted, only their values:

INSERT INTO table_name
VALUES (value1,value2,value3,...);

The second form specifies both the column names and the values to be inserted:

INSERT INTO table_name (column1,column2,column3,...)
VALUES (value1,value2,value3,...);

Inserting a Record in Database Table
11:50

The SELECT statement is used to select data from a database.

Selecting specific table fields:

SELECT column_name,column_name FROM table_name;

Selecting all table fields.

SELECT * FROM table_name;


Selecting a Record From Database Table
09:57

The UPDATE statement is used to update existing records in a table.

UPDATE table_name
SET column1=value1,column2=value2,...
WHERE some_column=some_value;


Updating a Record in Database Table
06:24

The DELETE statement is used to delete rows in a table.

Deleting a specific record.

DELETE FROM table_name
WHERE some_column=some_value;


Deleting a Record From the Table
04:21

In a relational database, relationships enable you to prevent redundant data. For example, if you are designing a database that will track information about books, you might have a table called titles that stores information about each book, such as the book's title, date of publication, and publisher. There is also information you might want to store about the publisher, such as the publisher's phone number, address, and zip code. If you were to store all of this information in the titles table, the publisher's phone number would be duplicated for each title that the publisher prints

A better solution is to store the publisher information only once in a separate table, publishers. You would then put a pointer in the titles table that references an entry in the publisher table.

To make sure your data is not out of sync, you can enforce referential integrity between the titles and publishers tables. Referential integrity relationships help ensure information in one table matches information in another. For example, each title in the titles table must be associated with a specific publisher in the publishers table. A title cannot be added to the database for a publisher that does not exist in the database.

Why Relationships in RDBMS
10:08

In a one-to-one relationship, a row in table A can have no more than one matching row in table B, and vice versa. A one-to-one relationship is created if both of the related columns are primary keys or have unique constraints.

This type of relationship is not common because most information related in this way would be all in one table. You might use a one-to-one relationship to:

  • Divide a table with many columns.
  • Isolate part of a table for security reasons.
  • Store data that is short-lived and could be easily deleted by simply deleting the table.
  • Store information that applies only to a subset of the main table.

The primary key side of a one-to-one relationship is denoted by a key symbol. The foreign key side is also denoted by a key symbol.

One-to-One Relationship
08:09

A one-to-many relationship is the most common type of relationship. In this type of relationship, a row in table A can have many matching rows in table B, but a row in table B can have only one matching row in table A. For example, the publishers and titles tables have a one-to-many relationship: each publisher produces many titles, but each title comes from only one publisher.

Make a one-to-many relationship if only one of the related columns is a primary key or has a unique constraint.

The primary key side of a one-to-many relationship is denoted by a key symbol. The foreign key side of a relationship is denoted by an infinity symbol.

One-to-Many Relationship
07:30

In a many-to-many relationship, a row in table A can have many matching rows in table B, and vice versa. You create such a relationship by defining a third table, called a junction table, whose primary key consists of the foreign keys from both table A and table B. For example, the authors table and the titles table have a many-to-many relationship that is defined by a one-to-many relationship from each of these tables to the titleauthorstable. The primary key of the titleauthors table is the combination of the au_id column (the authors table's primary key) and the title_idcolumn (the titles table's primary key).

Many-to-Many Relationship
08:34

A primary key is a column or a set of columns that uniquely identifies each row in the table. You must follow the rules below when you define a primary key for a table:

  • A primary key must contain unique values. If the primary key consists of multiple columns, the combination of values in these columns must be unique.
  • A primary key column cannot contain NULL values. It means that you have to declare the primary key column with the NOT NULL  attribute. If you don’t, MySQL will force the primary key column as NOT NULL  implicitly.
  • A table has only one primary key.


A foreign key is a field in a table that matches another field of another table. A foreign key places constraints on data in the related tables, which enables MySQL to maintain referential integrity.


Introduction to Primary & Foreign Keys
07:15

primary key is a column or a set of columns that uniquely identifies each row in the table. You must follow the rules below when you define a primary key for a table:

  • A primary key must contain unique values. If the primary key consists of multiple columns, the combination of values in these columns must be unique.
  • A primary key column cannot contain NULL values. It means that you have to declare the primary key column with the NOT NULL  attribute. If you don’t, MySQL will force the primary key column as NOT NULL  implicitly.
  • A table has only one primary key.
Creating a Primary Key
02:00

foreign key is a field in a table that matches another field of another table. A foreign key places constraints on data in the related tables, which enables MySQL to maintain referential integrity.

Creating a Foreign Key
11:33

The INNER JOIN keyword selects all rows from both tables as long as there is a match between the columns in both tables.

SELECT column_name(s)
FROM table1
INNER JOIN table2
ON table1.column_name=table2.column_name;

or:

SELECT column_name(s)
FROM table1
JOIN table2
ON table1.column_name=table2.column_name;

Inner Join
08:16

The LEFT JOIN keyword returns all rows from the left table (table1), with the matching rows in the right table (table2). The result is NULL in the right side when there is no match.

SELECT column_name(s)
FROM table1
LEFT JOIN table2
ON table1.column_name=table2.column_name;

or:

SELECT column_name(s)
FROM table1
LEFT OUTER JOIN table2
ON table1.column_name=table2.column_name;

Left Outer Join
05:47

The RIGHT JOIN keyword returns all rows from the right table (table2), with the matching rows in the left table (table1). The result is NULL in the left side when there is no match.

SELECT column_name(s)
FROM table1
RIGHT JOIN table2
ON table1.column_name=table2.column_name;

or:

SELECT column_name(s)
FROM table1
RIGHT OUTER JOIN table2
ON table1.column_name=table2.column_name;

Right Outer Join
06:25
+
MySQLi Advanced Prepared Statements & Security
4 Lectures 29:42

A prepared statement is a feature used to execute the same (or similar) SQL statements repeatedly with high efficiency.

Prepared statements basically work like this:

  1. Prepare: An SQL statement template is created and sent to the database. Certain values are left unspecified, called parameters (labeled "?"). Example: INSERT INTO MyGuests VALUES(?, ?, ?)
  2. The database parses, compiles, and performs query optimization on the SQL statement template, and stores the result without executing it
  3. Execute: At a later time, the application binds the values to the parameters, and the database executes the statement. The application may execute the statement as many times as it wants with different values.


Compared to executing SQL statements directly, prepared statements have two main advantages:

  • Prepared statements reduces parsing time as the preparation on the query is done only once (although the statement is executed multiple times)
  • Bound parameters minimize bandwidth to the server as you need send only the parameters each time, and not the whole query
  • Prepared statements are very useful against SQL injections, because parameter values, which are transmitted later using a different protocol, need not be correctly escaped. If the original statement template is not derived from external input, SQL injection cannot occur.
Inserting a Record in Table
05:34

A prepared statement is a feature used to execute the same (or similar) SQL statements repeatedly with high efficiency.

Prepared statements basically work like this:

  1. Prepare: An SQL statement template is created and sent to the database. Certain values are left unspecified, called parameters (labeled "?"). Example: INSERT INTO MyGuests VALUES(?, ?, ?)
  2. The database parses, compiles, and performs query optimization on the SQL statement template, and stores the result without executing it
  3. Execute: At a later time, the application binds the values to the parameters, and the database executes the statement. The application may execute the statement as many times as it wants with different values.


Compared to executing SQL statements directly, prepared statements have two main advantages:

  • Prepared statements reduces parsing time as the preparation on the query is done only once (although the statement is executed multiple times)
  • Bound parameters minimize bandwidth to the server as you need send only the parameters each time, and not the whole query
  • Prepared statements are very useful against SQL injections, because parameter values, which are transmitted later using a different protocol, need not be correctly escaped. If the original statement template is not derived from external input, SQL injection cannot occur.
Selecting a Record From Table
14:26

A prepared statement is a feature used to execute the same (or similar) SQL statements repeatedly with high efficiency.

Prepared statements basically work like this:

  1. Prepare: An SQL statement template is created and sent to the database. Certain values are left unspecified, called parameters (labeled "?"). Example: INSERT INTO MyGuests VALUES(?, ?, ?)
  2. The database parses, compiles, and performs query optimization on the SQL statement template, and stores the result without executing it
  3. Execute: At a later time, the application binds the values to the parameters, and the database executes the statement. The application may execute the statement as many times as it wants with different values.


Compared to executing SQL statements directly, prepared statements have two main advantages:

  • Prepared statements reduces parsing time as the preparation on the query is done only once (although the statement is executed multiple times)
  • Bound parameters minimize bandwidth to the server as you need send only the parameters each time, and not the whole query
  • Prepared statements are very useful against SQL injections, because parameter values, which are transmitted later using a different protocol, need not be correctly escaped. If the original statement template is not derived from external input, SQL injection cannot occur.
Updating a Record in The Table
06:03

A prepared statement is a feature used to execute the same (or similar) SQL statements repeatedly with high efficiency.

Prepared statements basically work like this:

  1. Prepare: An SQL statement template is created and sent to the database. Certain values are left unspecified, called parameters (labeled "?"). Example: INSERT INTO MyGuests VALUES(?, ?, ?)
  2. The database parses, compiles, and performs query optimization on the SQL statement template, and stores the result without executing it
  3. Execute: At a later time, the application binds the values to the parameters, and the database executes the statement. The application may execute the statement as many times as it wants with different values.


Compared to executing SQL statements directly, prepared statements have two main advantages:

  • Prepared statements reduces parsing time as the preparation on the query is done only once (although the statement is executed multiple times)
  • Bound parameters minimize bandwidth to the server as you need send only the parameters each time, and not the whole query
  • Prepared statements are very useful against SQL injections, because parameter values, which are transmitted later using a different protocol, need not be correctly escaped. If the original statement template is not derived from external input, SQL injection cannot occur.
Delete a Record From The Table
03:39
4 More Sections
About the Instructor
Assad Ullah Ch
5.0 Average rating
1 Review
3 Students
1 Course
Software Engineer, Web Ninja & Premium Udemy Instructor

He is a Software Engineer and Full Stack Web Developer. He is an experienced freelance Web Developer and also an experienced Instructor. The major courses he has been teaching are PHP Procedural, PHP Object Oriented Programming, Codeigniter, JavaScript, jQuery, HTML5, CSS3 & Twitter Bootstrap. 

He loves his profession whether it's Web Development or teaching and people loves the way he teach. He can also teach C, C++, Data Structure & Algorithms, Design & Algorithm Analysis, Java, Python and Objective-C. His social life is computers.

He would love to get your feedback about his courses because it will help him out to produce quality tutorials.