hello

Monday, October 6, 2014

2.4 $_REQUEST

The CODE














- Just like in the previously tutorial, we used the $_REQUEST global variable in retrieving / catching data. But the difference is you dont need to change the method of the form. Generally, it will acts depends on what method of the form you declared. Just like when the method of the form is GET is will handle the data just like the $_GET same as well in the $_POST variable.

2.3 $_POST

The Code















- Ok guys, this is the code inside of controller.php using the global variabe $_POST. Just like the previous $_GET tutorial. We used the $_POST variable in order for us to retrieved/catch data of the form having POST. Now lets observe the output.

Sunday, October 5, 2014

2.2 $_GET

The Code (Controller.php)














- This is the code inside our controller.php.     As you notice, we used the $_GET variable to catch the data of the form having GET method. This is basically the whole logic of this tutorial.  Then we echo or print out the retrieved data in order for us to see it in the browser.

2.1 Parts of Html Form










In this section, we will discuss about the basic parts of the form. Though I know the you already familiar with this when you study about html. Now its about time to put this form it to action!

A form is basically a container for your html variables like inputbox, button, radio, checkbox and so on. And form can also contain some attributes like action and method. There are lots of a form can use but for the sake of this tutorial we will just tackle only these two attributes since it is commonly used most of the time especially in server side scripting

Wednesday, September 24, 2014

Pre-requisites

Dear Readers,

Below mention is some pre-requisites that you must  acknowledge first before we proceed to the rest of these tutorials.

1) You must know basic HTML & CSS structures and how it flows
2) Your are using PHP version not less than 5
3) If you already know how to create a database, then kindly create database with a name "db_users" and table as "tbl_users"
4) Im uisng XAMMP for this tutorial but you can use WAMP (for Windows) and LAMP (for LINUX)



That's all folks


3.4 Delete

1) Connection

       
//Connection variables -->START

$host = 'localhost';    /*domain name or host path*/
$user = 'root';         /*database username*/
$pass = 'your_db_pass'; /*database password*/ 
$database = 'db_users';    /*database name*/

//Connection variables-->END
  

2) Connection to Database

       
/*Create a connection to database*/
$connection = mysql_connect($host, $user, $pass) or die('Connection Failed');

/*Selecting the database based on suplied connection*/
$select_db = mysql_select_db($database, $connection) or die('Connection DB Failed');
  


3)The Query

/*Make a Query DELETE*/
$query = "delete from  users_tbl where username='hac101'";


4) Full Code

       
//Connection variables -->START

$host = 'localhost';    /*domain name or host path*/
$user = 'root';         /*database username*/
$pass = 'your_db_pass'; /*database password*/ 
$database = 'db_users';    /*database name*/

//Connection variables-->END

/*Create a connection to database*/
$connection = mysql_connect($host, $user, $pass) or die('Connection Failed');

/*Selecting the database based on suplied connection*/
$select_db = mysql_select_db($database, $connection) or die('Connection DB Failed');

/*Make a Query DELETE*/
$query = "delete from  users_tbl where username='hac101'";

/*Run the Query*/
$result = mysql_query($query) or die("Query Failed");

Tuesday, September 23, 2014

3.2 Select

1) Connection
       
 
  //Connection variables -->START

$host = 'localhost';    /*domain name or host path*/
$user = 'root';         /*database username*/
$pass = 'your_db_pass'; /*database password*/ 
$database = 'db_users';    /*database name*/

//Connection variables-->END

       
 

PHP & MySQL Tutorial

Table of Contents


1. Pre-requisites
2. Global Variables
2.1 Parts of Html Form
2.2 $_GET
2.3 $_POST
2.4 $_REQUEST
3. Single
3.1 insert.php
3.2 select.php
3.3 update.php
3.4 delete.php
4 Multiple
4.1 index.php
4.2 connection.php
4.3 edit.php
4.4 controller.php

3.1 Insert

1) Connection


       
//Connection variables -->START

$host = 'localhost';    /*domain name or host path*/
$user = 'root';         /*database username*/
$pass = 'your_db_pass'; /*database password*/ 
$database = 'db_users';    /*database name*/

//Connection variables-->END