Welcome

Welcome To PHP-MySql Blog. A One site to learn basic as well as advance functions of PHP.

Note

Here you will get all the knowledge about PHP-Mysql And how to integrate php in html

What Is PHP

What is PHP?

  • PHP (recursive acronym for PHP: Hypertext Preprocessor)
  • PHP is a server-side scripting language, like ASP
  • PHP scripts are executed on the server
  • PHP supports many databases (MySQL, Informix, Oracle, Sybase, Solid, PostgreSQL, Generic ODBC, etc.)
  • PHP is an open source software
  • PHP is free to download and use

What is a PHP File?

  • PHP files can contain text, HTML tags and scripts
  • PHP files are returned to the browser as plain HTML 
  • PHP files have a file extension of ".php", ".php3", or ".phtml"

What is MySQL?

  • MySQL is a database server
  • MySQL is ideal for both small and large applications
  • MySQL supports standard SQL
  • MySQL compiles on a number of platforms
  • MySQL is free to download and use

PHP + MySQL

  • PHP combined with MySQL are cross-platform (you can develop in Windows and serve on a Unix platform)

1. Installing a Webserver with PHP and MySQL (XAMPP in Windows)

Installing a Webserver with PHP and MySQL (XAMPP in Windows) :
  • Installing XAMPP in Windows
  • XAMPP is a cumulative package consisting of Apache, PHP and MySQL Packages is available both for windows and linux
  • In this tutorial the XAMPP will be installed and the default webserver directry will be "htdocs".
Xampp Download :
http://www.apachefriends.org/en/xampp.html

2. Echo PHP Function, PHP Variables, If and Switch Statements

Echo Function :
  • The echo() function outputs one or more strings.
  • Syntax: echo(strings);
  • Ex. echo "Hello World!";
http://pastebin.com/b9xc54uc
Variables in PHP :
  • Variables are used for storing values, like text strings, numbers or arrays.
  • When a variable is declared, it can be used over and over again in your script.
  • All variables in PHP start with a $ sign symbol.
  • The correct way of declaring a variable in PHP: $var_name = value;
http://pastebin.com/aBkwyB4K
 If Statement :
  • if statement - use this statement to execute some code only if a specified condition is true.
  • if...else statement - use this statement to execute some code if a condition is true and another code if the condition is false.
  • if...elseif....else statement - use this statement to select one of several blocks of code to be executed.
http://pastebin.com/WQMGVtjz
Switch Statement :
  • switch statement - use this statement to select one of many blocks of code to be executed
http://pastebin.com/mGngHSsq

3. PHP Operators

Arithmatic Operators :
  • Ex. +,-,*,/,%,++,--
http://pastebin.com/VBXuG5xT
Comparison Operators :
  • Ex. ==,!=,<>,>,<,>=,<=
http://pastebin.com/eBgcTdVv
Logical Operators :
  • Ex. && (AND),|| (OR),! (NOT)
http://pastebin.com/h1ESjRqX

4. Arrays in PHP

Arrays :
  • An array stores multiple values in one single variable.
  • Numeric array - An array with a numeric index.
  • Associative array - An array where each ID key is associated with a value.
  • Ex. Numeric Array: $fruits=array("Apple","Mango","Banana","Grapes");
http://pastebin.com/SwJH96b1
Multi-Dimensional Arrays :
  • In a multidimensional array, each element in the main array can also be an array. And each element in the sub-array can be an array, and so on.
http://pastebin.com/eVEF0WZM