This code generate database correctly. This code is in C:\inetpub\wwwroot\mini location but it generates the database in C:\ProgramData\MySQL\MySQL Server 5.6\data
How to create database in same place where the code is??
<?php
$conn=new mysqli("localhost","root","hiitisme");
$dept=$conn->escape_string($_POST['dept']);
$class=$conn->escape_string($_POST['class']);
$create=$conn->escape_string($_POST['new']);
if($create=="create")
{
$sql="CREATE DATABASE $dept";
$conn->query($sql);
$sql="USE $dept";
$conn->query($sql);
$sql="CREATE TABLE $class(Rollno integer,name varchar(30),phone integer(10),email varchar(20))";
$conn->query($sql);
echo "database createed suceefully";
}
?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With