hello, i am currently trying to make a piece of PHP code that allows me to make a database when i click a button i have the following code but it doesn't seem to work ( i have obviously put in my own mysql details ect ).
Code:
<?PHP
// Connects to your Database
mysql_connect("localhost", "my_user", "password") or die(mysql_error());
mysql_select_db("my_db") or die(mysql_error());
if ($_POST['submit']) {
// command to make database
$sql = ("CREATE DATABASE my_db");
// creates the database
mysql_query($sql);
// database created message
echo "Database created sucessfully";
}
else {
// datebase not created message
echo "Database creation failed";
}
?>
<html>
<body>
<div align="center">
<form name="form1" method="post" action="">
<label>
<input name="submit" type="submit" id="submit" value="Install">
</label>
</form>
</div>
</body>
</html>