Hi Everyone,
I have a problem to create a database using PHP in my website in Zymic, though I have no problem to do so in my own computer which has the Apache, PHP and MYSQL installed. But in my mechine, I need to use "root" to replace "myusername" to make this work. After I uploaded my codes with some modifications of my username and my password, the code did not work. I have no problem in creating databases using my database management panel of this website. I am just curious about whether I can use PHP codes to create databases. I am just wondering whether I have the privilege to create database using PHP. The following is the codes I used. Could anybody give some help on this?
php
$mysqli = new mysqli("localhost", "myusername_myusername", "mypassword");
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
} else {
echo " First, connected!!!";
}
$sql0 = "CREATE DATABASE myusername_ttt99";
$res = mysqli_query($mysqli, $sql0);
if($res){
echo " SUCCESS!!!!!!!";
}
mysqli_close($mysqli)
?>
Thank you very much. Your kind help is highly appreciated!
