CREATE DATABASE WITH PHP

PHP can connetct to MySql. It can create database, table,insert,update, and delete record. To create database you can use sintaks in MySql query language. This is following sintaks to create database in MySql query language 'CREATE DATABASE db_trial' (without single quote). But, before we can make database in PHP, we have to connect PHP with MySql first. Connect php to MySql was I publish before, so we can use connect.php to connect our php to MySql. Now we make php file to create a database.This is following file.


download createdb.php

This sintaks will make a database named 'db_trial'and will show sentences about succes or not to make a database, but before it make a database, it need connect.php to comunicate php file with MySql. The sintaks to use other php file is (include 'connect.php';). And $con sintaks mean a connect sintaks which this is in connect.php file. Save your file(s) in your server directory. If you install XAMPP in C:\Program Files\xampp”. Go to “htdocs” folder, and make a folder named “php”, finally put your php files there.
To try this file(s) you type in your browser url http://localhost/php/ and click “createdb.php”. If create database was succesful you will see following picture .






To check your database was made, you can go to your browser, type 'http://localhost/phpmyadmin/'. If database already exist you will see this following picture.


Good luck ^_^

0 comments:

Post a Comment

/*ini ttg amazon*/ /*selese di sini*/