hello

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