Help - Search - Members - Calendar
Full Version: Problem In Creating A Database Using Php
Zymic Webmaster Forums > Zymic Free Web Hosting > Databases & MySQL
ztforward
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!

swordz
I'm afraid you don't have the permissions to create db's/users - you can only use the db management we give you.

swordz
ztforward
QUOTE(swordz @ May 25 2009, 11:14 PM) *
I'm afraid you don't have the permissions to create db's/users - you can only use the db management we give you.

swordz



Thank you very much for your prompt reply. That clears things up. I appreciate.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.