Create MySQL Database Programmatically PHP Script
Create MySQL Database Programmatically PHP Script
Tools I used:
-Notepad++
-Wamp server
This program is use to connect to database and create database in wamp server. Create a new folder (any name) on www in wamp folder then paste the createdatabase.php code. Then voila congratulations you are connected!
Code:
Tools I used:
-Notepad++
-Wamp server
This program is use to connect to database and create database in wamp server. Create a new folder (any name) on www in wamp folder then paste the createdatabase.php code. Then voila congratulations you are connected!
Code:
<html>
<body>
<?php
$con = mysql_connect("localhost", "root", ""); //tandaan laging may root dapat pagdefault
if (!$con) {
die('Hindi makaconnect sa database');
}
if (mysql_query("CREATE DATABASE my_carlo", $con)) //mysql_query is tool for connecting to mysql
{ //kung ano yung database name mo palitan mo yung my_carlo
echo "Congratulations! database created";
} else {
echo "Error creating database";
}
?>
</body>
</html>
Comments
Post a Comment