Showing posts with label PHP Programming. Show all posts
Showing posts with label PHP Programming. Show all posts

Monday, 9 December 2013

Retrieving Data from MYSQL Database using PHP


Using these easy steps you can easily retrieve the data from MYSQL database. In this example I am assuming that you have already created MYSQL database and already contains some tabular data.
Create database named mydb
CREATEDATABASE `mydb`;

Create Table student on mydb Database:
Table info is created with three fields: id, name and Email Address. Id will be automatically incremented after every insert operation.
CREATE TABLE `mydb`.`student` (
`id` INT NOT NULL AUTO_INCREMENT,
`name`VARCHAR(100)NOTNULL,
`contact_no`int(20)NOTNULL,
PRIMARYKEY(`id`)
) ENGINE = MYISAM

Insert some raw data for Accessing
INSERT INTO `mydb`.`student` (`id`, `name`, `contact_no`) VALUES (NULL, 'Dashmesh', '123456');
Create Database Connection (connection.php)

How to insert PHP Form data into MYSQL Database?

Here are some easy steps that are used to insert PHP data into MYSQL database
      1) Create MYSQL database
           2) Create index.php or index.html page with required inputs.
           3) PHP script to insert data.
           4) Database connection
Create the database testing
CREATEDATABASE `testing`;
 
Create Table info on testing Database:
Table info is created with three fields: id, name and Email Address. Id will be automatically incremented after every insert operation.
CREATE TABLE `testing`.`info` (
`id` INT NOT NULL AUTO_INCREMENT,
`name`VARCHAR(100)NOTNULL,
`email`VARCHAR(100)NOTNULL,
PRIMARYKEY(`id`)
) ENGINE = MYISAM