0% found this document useful (0 votes)
17 views3 pages

STEPS-CRUD Config and DB

The document outlines steps to create a CRUD application in PHP and MySQL. It describes creating a database and table, inserting sample data, and creating a config file to store database connection details.

Uploaded by

upsi zulkipli
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views3 pages

STEPS-CRUD Config and DB

The document outlines steps to create a CRUD application in PHP and MySQL. It describes creating a database and table, inserting sample data, and creating a config file to store database connection details.

Uploaded by

upsi zulkipli
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

STEPS - https://www.codepolitan.

com/tutorial-membuat-
crud-php-dengan-mysql-59897c72d8470
1. CREATE DATABASE AND TABLE
/* Create Database and Table */
create database crud_db;

use crud_db;

CREATE TABLE `users` (


`id` int(11) NOT NULL auto_increment,
`name` varchar(100),
`email` varchar(100),
`mobile` varchar(15),
PRIMARY KEY (`id`)
);

Below is the structure:

--------------------------------------------------------------------------------------------------------------------------------

2. Insert data into database using SQL or you may insert the data manually in the MYSQL

Eg:

insert into users(name, email,mobile) values ("Ali


Anwar","[email protected]","011-4502089"),("Mohd
Ariff","[email protected]","011-4502900");
--------------------------------------------------------------------------------------------------------------------------------

3. CREATE config.php FILE - to store information about database host,


username and password.
<?php
/**
* using mysqli_connect for database connection
*/

$databaseHost = 'localhost';
$databaseName = 'crud_db';
$databaseUsername = 'root';
$databasePassword = '';

$mysqli = mysqli_connect($databaseHost, $databaseUsername, $databasePassword,


$databaseName);

//check database connection


if($mysqli) {
echo "connection ok -- http://localhost/crud_db/php/config.php";
}
else {
echo "prob with connection";
}

?>

You might also like